Skip to content

Добавил коллектор для % покрытия тестами#1

Merged
PANiXiDA merged 13 commits into
mainfrom
add-coverage-collector
Nov 7, 2025
Merged

Добавил коллектор для % покрытия тестами#1
PANiXiDA merged 13 commits into
mainfrom
add-coverage-collector

Conversation

@PANiXiDA
Copy link
Copy Markdown
Contributor

@PANiXiDA PANiXiDA commented Nov 7, 2025

No description provided.

@PANiXiDA
Copy link
Copy Markdown
Contributor Author

PANiXiDA commented Nov 7, 2025

@codex посмотришь еще раз mr после последних коммитов?

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 28 to 30
var count = faker.Random.Int(2, 5);
var dictionaryType = typeof(Dictionary<,>).MakeGenericType(keyType!, valueType!);
var dictionary = (IDictionary)Activator.CreateInstance(dictionaryType)!;
var dictionary = (IDictionary)CreateEmptyDictionary(type, keyType!, valueType!)!;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Casting generated dictionaries to non-generic IDictionary breaks added types

The generator now treats SortedDictionary<,> and ConcurrentDictionary<,> as supported, but the instance created in CreateEmptyDictionary is immediately cast to IDictionary. These concrete types do not implement the non-generic IDictionary interface, so requesting a SortedDictionary<TKey,TValue> or ConcurrentDictionary<TKey,TValue> will throw InvalidCastException at line 29 instead of returning a populated dictionary.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex поправил, посмотри пожалуйста

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +31 to +40
if (dictionaryInstance is ConcurrentDictionary<object, object> concurrentDict)
{
var key = GenerateKey(keyType!, context);
if (key is null)
{
safety++;
continue;
}

var val = context.Resolve(valueType!);

if (!dictionary.Contains(key))
{
dictionary.Add(key, val);
}

safety++;
FillConcurrent(concurrentDict, keyType!, valueType!, context, count);
value = concurrentDict;
return true;
}
else
{
var dictionary = (IDictionary)dictionaryInstance;
FillDictionary(dictionary, keyType!, valueType!, context, count);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid casting ConcurrentDictionary to non-generic IDictionary

The new ConcurrentDictionary path never matches real ConcurrentDictionary<TKey,TValue> instances because dictionaryInstance is ConcurrentDictionary<object, object> cannot succeed for closed generics with other type arguments. When the pattern fails, the code falls through to the else branch and casts the concurrent dictionary to IDictionary, which it does not implement, resulting in an InvalidCastException whenever a concurrent dictionary is generated. The detection should use the generic type definition (e.g., typeof(ConcurrentDictionary<,>).IsAssignableFrom(instance.GetType())) or operate through IDictionary<,> instead of the non-generic IDictionary cast.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex я поправил. посмотришь?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@PANiXiDA PANiXiDA merged commit 483339c into main Nov 7, 2025
2 checks passed
@PANiXiDA PANiXiDA deleted the add-coverage-collector branch November 7, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants