Skip to content

New Analyzer CC0125 - getter only auto property#904

Merged
carloscds merged 10 commits intocode-cracker:masterfrom
MaStr11:CC0125GetterOnlyAutoProperty
May 3, 2017
Merged

New Analyzer CC0125 - getter only auto property#904
carloscds merged 10 commits intocode-cracker:masterfrom
MaStr11:CC0125GetterOnlyAutoProperty

Conversation

@MaStr11
Copy link
Copy Markdown
Contributor

@MaStr11 MaStr11 commented Mar 22, 2017

Fixes #881.

New analyzer CC0125 - getter only auto property.

Port from https://github.com/ifpanalytics/Ifp.Analyzers.

Remaining issues:

  • Renaming may introduce name clash. See Test method RenamingOfFieldAccessCanIntroduceNameClashesCaughtByCompilerWarningCS1717
  • Batchfixer The CodeFixProvider uses the WellKnownFixAllProviders.BatchFixer. The BatchFixer is not able to fix multiple properties in a class at once (fixes about every second property in a class at once). There are not tests covering the FixAllProvider.

Let me know if any of these issues are show-stoppers and I will look into it.

I also prepared the documentation for the analyzer at code-cracker/code-cracker.github.io@master...MaStr11:DocsForCC0125.
I can create a pull request as needed.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.04%) to 91.561% when pulling b4d2856 on MaStr11:CC0125GetterOnlyAutoProperty into 6471990 on code-cracker:master.

@carloscds carloscds self-assigned this Mar 24, 2017
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.03%) to 91.562% when pulling fa20c95 on MaStr11:CC0125GetterOnlyAutoProperty into 6471990 on code-cracker:master.

@MaStr11
Copy link
Copy Markdown
Contributor Author

MaStr11 commented Mar 27, 2017

@carloscds The last commit (fa20c95) only added one line of code to prevent an ArgumentException and to increase performance.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.02%) to 91.576% when pulling 308f450 on MaStr11:CC0125GetterOnlyAutoProperty into 6471990 on code-cracker:master.

@MaStr11
Copy link
Copy Markdown
Contributor Author

MaStr11 commented Mar 29, 2017

@carloscds I pushed another small change related to the previous bug. The cause of the bug is now covert by unit tests. The fixer does not rename fields in partial classes causing a CS0103 The name 'identifier' does not exist in the current context compiler error after the fix is applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace getter only properties with backing readonly field with getter-only auto-property

4 participants