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

Consider pure functions as part of CA1806. #1171

Merged
merged 2 commits into from
May 4, 2017

Conversation

333fred
Copy link
Member

@333fred 333fred commented Apr 27, 2017

Functions that are marked Pure have no side effects, and should be considered when we check to see if function results are discarded without use. Fixes #1164. Tagging @dotnet/analyzer-ioperation @sharwell for review.

@sharwell
Copy link
Member

@333fred I'd be interested in gathering some churn metrics in some common cases for this change. For example, how many more diagnostics were reported due to this change in:

  • Roslyn.sln
  • CodeContracts.sln (a pathological case we often use for analyzer testing)
  • Json.NET

@333fred
Copy link
Member Author

333fred commented May 2, 2017

@sharwell investigated:

  • Roslyn - very little usage of Pure, no additional warnings
  • CodeContracts - Lots of Pure, no new warnings. They do have a few for not ignoring HResults/dropping objects. I did have issues building the solution, so I can't 100% guarantee that it actually analyzed everything.
  • Json.NET - Does not use Pure.

@333fred
Copy link
Member Author

333fred commented May 3, 2017

Ping @sharwell @dotnet/roslyn-analysis for review here.

@@ -6,6 +6,8 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Semantics;
using System.Diagnostics.Contracts;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sort usings.

@333fred 333fred merged commit ad26a26 into dotnet:master May 4, 2017
@333fred 333fred deleted the consider-pure-functions branch May 4, 2017 17:09
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.

4 participants