Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #142 by changing includeTags filtering and restoring collection snapshots #143

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

kirides
Copy link
Contributor

@kirides kirides commented Sep 7, 2023

fixes #142 by changing includeTags filtering and restoring collection snapshots.

exclusion is now defined in a single statement, instead of a loop, to reduce likelyhood of failures.

Fixes improper use of collection enumeration and mutation while doing so.
We may not use code like the following, as that may either crash or produce UB.

foreach (var x in collection.Where(x....))
{
    // NOT OK
    collection.Remove(y);
}

instead, every mutating operation on a collection should enumerate on a snapshot

foreach (var x in collection.Where(x....).ToArray())
{
    // OK
    collection.Remove(y);
}

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Merging #143 (6311a60) into main (38092e9) will decrease coverage by 0.09%.
The diff coverage is 90.00%.

@@            Coverage Diff             @@
##             main     #143      +/-   ##
==========================================
- Coverage   98.55%   98.47%   -0.09%     
==========================================
  Files          37       37              
  Lines        1176     1178       +2     
==========================================
+ Hits         1159     1160       +1     
  Misses          6        6              
- Partials       11       12       +1     
Flag Coverage Δ
unittests 98.47% <90.00%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/Refitter.Core/RefitGenerator.cs 99.31% <87.50%> (-0.69%) ⬇️
src/Refitter.Tests/Examples/FilterByTagsTests.cs 100.00% <100.00%> (ø)

Copy link
Owner

@christianhelle christianhelle left a comment

Choose a reason for hiding this comment

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

Looks good to me

@christianhelle christianhelle merged commit 1ab981d into christianhelle:main Sep 7, 2023
@kirides kirides deleted the fix_filter_by_tags branch September 7, 2023 12:42
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.

Filter --tag broken
2 participants