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

Implement SA1314 (TypeParameterNamesMustBeginWithT) #1925

Merged
merged 6 commits into from
Nov 20, 2016

Conversation

nbarbettini
Copy link
Contributor

Fixes #739. Includes code fix, tests, and documentation.

Let me know if there's any test scenarios I didn't think of!

@codecov-io
Copy link

codecov-io commented Dec 6, 2015

Current coverage is 96.88% (diff: 98.01%)

Merging #1925 into master will increase coverage by <.01%

@@             master      #1925   diff @@
==========================================
  Files           586        589     +3   
  Lines         80814      81066   +252   
  Methods        3487       3497    +10   
  Messages          0          0          
  Branches       3090       3098     +8   
==========================================
+ Hits          78295      78542   +247   
- Misses         1680       1682     +2   
- Partials        839        842     +3   

Powered by Codecov. Last update b934782...1f72cb7

@sharwell
Copy link
Member

sharwell commented Dec 6, 2015

❗ naming rules have IDs with the form SA13xx.

❓ should we refer to "type parameters" instead of "generic parameters"?

@vweijsters
Copy link
Contributor

Type parameters would be preferred for me

@nbarbettini
Copy link
Contributor Author

I wasn't sure myself; I'd be totally fine with changing it to "type parameters" across the board.

@nbarbettini nbarbettini changed the title Implement SA1654 GenericParameterNamesMustBeginWithT Implement SA1314 (TypeParameterNamesMustBeginWithT) Dec 8, 2015
@nbarbettini
Copy link
Contributor Author

Fixed both the ID and the rule name. 👍

@@ -52,6 +52,20 @@ internal static class RenameHelper

var containingSymbol = symbol.ContainingSymbol;

if (symbol.Kind == SymbolKind.TypeParameter)
Copy link
Member

Choose a reason for hiding this comment

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

We cant rename the type parameter if there is already a type with the same name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean (for example) if there was already a class named TKey?

Copy link
Member

Choose a reason for hiding this comment

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

Exactly

@pdelvo
Copy link
Member

pdelvo commented Dec 8, 2015

Maybe we should include a test to verify that this also works for type parameters in method signatures

@nbarbettini
Copy link
Contributor Author

@pdelvo Added a test case for type parameters in method signatures, and also refactored the logic in RenameHelper to handle conflicts with other types.

@sharwell sharwell added this to the 1.1.0 Beta 1 milestone Dec 30, 2015
@sharwell sharwell mentioned this pull request Dec 30, 2015
Copy link
Member

@sharwell sharwell left a comment

Choose a reason for hiding this comment

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

There were two conflicts with the latest master branch, but I went ahead and fixed them:

  1. Minor conflict where the version number in the solution file was updated in two different branches (resolved to the most recent one)
  2. API conflict related to registering analysis callbacks (resolved by updating SA1314 implementation to use the new pattern)

I also fixed two trivial style issues for consistency.

@sharwell sharwell merged commit 4da56fd into DotNetAnalyzers:master Nov 20, 2016
@sharwell sharwell deleted the fix-739 branch November 20, 2016 17: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.

Implement SA1314: TypeParameterNamesMustBeginWithT
5 participants