-
Notifications
You must be signed in to change notification settings - Fork 41
SONARXML-180 : Fix FP in IndentationCheck (S1120) for string line continuation #398
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
base: master
Are you sure you want to change the base?
Conversation
|
|
This PR is stale because it has been open 7 days with no activity. If there is no activity in the next 7 days it will be closed automatically |
GabrielFleischer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your method is a bit too broad and trim too many TPs.
I provided you with a moretest cases.
sonar-xml-plugin/src/main/java/org/sonar/plugins/xml/checks/IndentationCheck.java
Outdated
Show resolved
Hide resolved
sonar-xml-plugin/src/test/resources/checks/IndentationCheck/LineContinuation.xml
Show resolved
Hide resolved
sonar-xml-plugin/src/main/java/org/sonar/plugins/xml/checks/IndentationCheck.java
Show resolved
Hide resolved
- refactoring needed
|
I spent way too much time on it and it looks fixing it would be more complicated than initially expected. |
Revert "Draft of full solution not trimming too many FP" This reverts commit b604297. Revert "Refactoring : split test into MultilineString.xml and LineContinuation.xml" This reverts commit 0c9cc3e. Revert "Refactoring tests - use parametrized tests" This reverts commit e10bfa4. Revert "Refactoring - clean IndentationCheck.java" This reverts commit 43af5f0. Revert "Refactoring & behavior fix, add non-trivial tests" This reverts commit 300ab87. Revert "Fix qg" This reverts commit 653a104. Revert "Fix plugin test" This reverts commit 4194663. Revert "Continue small fixes and edge case tests" This reverts commit 712666c.
GabrielFleischer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, I join you on the fact that the lost FPs provide more value than the lost TPs.
So, LGTM
I still thing the comment explaining the exception would be better by using whitespaces rather than -, but this is nitpicky.
Co-authored-by: Gabriel Fleischer <[email protected]>
good catch, I applied the suggestion |
|
dorian-burihabwa-sonarsource
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking to keep out of release 2.15




Important notes
As noted in Gabriel's review, this PR will trim a few True Positives (TPs) in specific scenarios like the one below:
Current Context & Rationale
Currently, an issue is reported on the closing tag (
</string>) for the wrong reason.Why I chose not to implement the "Proper Check"
While Gabriel proposed checking string content indentation properly, I have decided to keep string content ignored in
IndentationCheck. I believe this remains the best option for the following reasons:Line ContinuationsandMultiline Strings), XML is frequently used to wrap raw data or code snippets (like the example below). In these cases, standard indentation rules are often not relevant.By maintaining the exclusion of string content from the check, and keeping the trivial check, we avoid reporting "accidental" issues on closing tags while preventing a high volume of False Positives in files containing embedded scripts or formatted text.