Skip to content

SONARJAVA-5537 S7476 remove FPs and reduce noise#5158

Merged
erwan-serandour merged 6 commits intomasterfrom
erwan/S7476_correct
May 19, 2025
Merged

SONARJAVA-5537 S7476 remove FPs and reduce noise#5158
erwan-serandour merged 6 commits intomasterfrom
erwan/S7476_correct

Conversation

@erwan-serandour
Copy link
Copy Markdown
Contributor

@erwan-serandour erwan-serandour commented May 16, 2025

SONARJAVA-5537

The rule doesn't raise anymore on:

  • licence headers at the start of files
  • on java code with source version above or equal 23. we don't raise an issue if a markdown comment start with 4 slashes.

The rule doesn't raise anymore on:
- licence headers at the start of files
- on java code with source version above or equal 23. we don't raise an issue if a markdown comment start with 4 slashes.
@erwan-serandour erwan-serandour changed the title SONARJAVA-5537 remove FPs and reduce noise SONARJAVA-5537 S7476 remove FPs and reduce noise May 16, 2025
.withCheck(check)
.withJavaVersion(23)
.verifyIssues();
.verifyNoIssues();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't have any examples starting with 4 or 5 /? Why not? I can imagine someone writing //// instead of ///.

{
"ruleKey": "S7476",
"hasTruePositives": true,
"hasTruePositives": false,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this rule skipped in autoscan? I thought we would have a few examples from the code introduces in unit test.

Copy link
Copy Markdown
Contributor Author

@erwan-serandour erwan-serandour May 16, 2025

Choose a reason for hiding this comment

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

it is because autoscan set the java sources to 23.

}

@Test
void test_after_java23() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"after 23" would be at least 24 :) Can we call is test_java23?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

@sonarqube-next
Copy link
Copy Markdown

public class CommentsMustStartWithCorrectNumberOfSlashesCheckJava23 {
// This is a comment
public void twoSlashes() {}
/// javadoc using markdown
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's use blank lines between declarations when they have a comment.

@erwan-serandour erwan-serandour merged commit 9d50cb6 into master May 19, 2025
17 checks passed
@erwan-serandour erwan-serandour deleted the erwan/S7476_correct branch May 19, 2025 14:19
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.

2 participants