Skip to content

Conversation

@sharwell
Copy link
Member

@sharwell sharwell commented Dec 2, 2025

Only changes tests.

Closes #3977

@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.45%. Comparing base (ff14d11) to head (55477d9).
⚠️ Report is 19 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4056   +/-   ##
=======================================
  Coverage   97.45%   97.45%           
=======================================
  Files         989      991    +2     
  Lines      115570   115626   +56     
  Branches     3423     3423           
=======================================
+ Hits       112632   112688   +56     
  Misses       1943     1943           
  Partials      995      995           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

{
public void Test()
{
Func<int, int, int> handler = (_, _) => 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Irrelevant test, since "handler" is the only variable here?

Copy link
Member Author

@sharwell sharwell Dec 3, 2025

Choose a reason for hiding this comment

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

It's a verification that _ is still ignored when it's treated as a true discard by the compiler. I was torn on whether to keep this test or not considering SA1313 is the one for parameters.

Copy link
Contributor

Choose a reason for hiding this comment

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

My assumption was that this diagnostic would only analyze "handler", not the discards, but that might be wrong

Copy link
Member Author

Choose a reason for hiding this comment

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

That's exactly the correct assumption. The question is, considering we can't cover all possible scenarios in all possible cases, where do we draw the line on tests to include for "unrelated items"? This one seems pretty close to the not-worth-it line, but ... 🤷

@sharwell sharwell merged commit f467479 into DotNetAnalyzers:master Dec 3, 2025
21 checks passed
@sharwell sharwell deleted the lambda-discard branch December 3, 2025 21:39
@sharwell sharwell added this to the 1.2-beta.next milestone Dec 3, 2025
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.

Review impact of lambda discard parameters on existing rules

2 participants