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

Fix SA1308CodeFixProvider creating empty identifier and add regression test #2337

Closed
wants to merge 3 commits into from

Conversation

jamesqo
Copy link
Contributor

@jamesqo jamesqo commented Apr 10, 2017

SA1308CodeFixProvider has a branch to prevent it from creating an empty identifier if the variable name consists solely of the offending prefix. However, if it consists only of multiple prefixes, e.g. m_s_t_, then it will try to rename the variable to the empty string.

This PR changes the logic to be more flexible, and adds regression tests. It also converts some existing tests for that analyzer to use Theory instead of Fact.

jamesqo added 3 commits April 10, 2017 00:13
- Checking token.ValueText.Length <= 2 beforehand implies the text is not null or empty
- Do not offer a code fix when a string consists entirely of multiple prefixes
@jamesqo
Copy link
Contributor Author

jamesqo commented Apr 10, 2017

I pulled from the wrong branch, unfortunately. I need to open a new PR.

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.

1 participant