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

Update resource analyzers to flag leading and trailing whitespaces #3973

Merged
merged 3 commits into from
Aug 9, 2020

Conversation

Evangelink
Copy link
Member

Fix #3958

@Evangelink Evangelink requested a review from a team as a code owner August 7, 2020 15:25
var additionalFileText = @"
<root>
<data name=""AnalyzerMessage1"" xml:space=""preserve"">
<value>Message with trailing whitespace </value>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add another scenario where trailing spaces are after a period, similar to the case caught in the original PR, say Message with trailing whitespaces after a period. ? I have a feeling your current logic might be need to be tweaked to move whitespace fixing part above multi-line fixing part.

@@ -605,6 +610,8 @@ private static void AnalyzeMessageCore(string message, IArgumentOperation argume
fixedMessage = endsWithPeriod ? RemoveTrailingPeriod(fixedMessage) : fixedMessage + ".";
}

fixedMessage = hasLeadingOrTrailingWhitespaces ? RemoveLeadingAndTrailingWhitespaces(fixedMessage) : fixedMessage;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might have to move ahead to just after we fix line returns but before the above if statement.

Copy link
Contributor

@mavasani mavasani left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Please add the recommended unit test, and check if your current logic needs to be tweaked or not for that test.

@codecov
Copy link

codecov bot commented Aug 9, 2020

Codecov Report

Merging #3973 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3973      +/-   ##
==========================================
+ Coverage   95.61%   95.63%   +0.01%     
==========================================
  Files        1155     1155              
  Lines      254900   255462     +562     
  Branches    15272    15282      +10     
==========================================
+ Hits       243724   244299     +575     
+ Misses       9215     9214       -1     
+ Partials     1961     1949      -12     

@mavasani mavasani merged commit 0a764ab into dotnet:master Aug 9, 2020
@Evangelink Evangelink deleted the resource-whitespaces branch August 10, 2020 05:45
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.

Update resources analyzers to flag leading and trailing spaces
2 participants