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

CA1806 (Do not ignore method results) could benefit from [PureAttribute] #1164

Closed
sharwell opened this issue Apr 25, 2017 · 0 comments
Closed
Assignees
Milestone

Comments

@sharwell
Copy link
Member

Analyzer package

Example: Microsoft.CodeQuality.Analyzers

Analyzer

CA1806 (Do not ignore method results)

Repro steps

  1. Declare a method which is marked with [Pure] and returns a value
  2. Call the method, ignoring the return value
[Pure]
public int Method()
  => 3;

public void Program()
{
  Method(); // CA1806??
}

Expected behavior

CA1806 could be reported.

Actual behavior

CA1806 is not reported.

📝 The potential increase in false positives for this rule is unknown. However, the ability to use var _ = to explicitly ignore such return values could compensate for the higher rate of reports.

@jinujoseph jinujoseph added this to the 15.3 milestone Apr 25, 2017
333fred added a commit to 333fred/roslyn-analyzers that referenced this issue Apr 27, 2017
333fred added a commit to 333fred/roslyn-analyzers that referenced this issue May 4, 2017
* master:
  Sorted usings
  Change the allowed version range for Microsoft.CodeAnalysis to [2.0.*-2.3.0) as we are still on the 2.0.0 packages of Microsoft.CodeAnalysis
  Verify IOperation API version in analyzer packages
  Update tests for new CA1052 assumption
  CA1052 ignore any classes that implement an interface.
  Fixed resource namespaces
  Refactored Microsoft.NetCore.Analyzers
  Refactored Microsoft.CodeQuality.Analyzers
  Fixed ca1812 to work for generic classes.
  Bump up prerelease version
  Fix broken hyperlink
  Update Versioning.md
  Fixed links in README
  Put CPS guid in sln to bypass selector
  Consider pure functions as part of CA1806. Fixes dotnet#1164.
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

No branches or pull requests

3 participants