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

Create rule CSS:S125: Sections of code should not be commented out #4338

Merged
merged 2 commits into from Oct 31, 2023

Conversation

yassin-kammoun-sonarsource
Copy link
Contributor

Fixes #4227

Relying solely on regular expressions to detect commented-out CSS code wasn't reliable. All issues raised on ruling were false positives. Therefore, I adopted the same approach with took with the implementation for JavaScript:

  1. Filter comments likely to contain commented code using regular expressions
  2. Check for syntactically valid code using a parsing function

Copy link
Contributor

@vdiez vdiez left a comment

Choose a reason for hiding this comment

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

amazing job! very complete

});
};

function isLikelyCss(text: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to have an example of what each regex is trying to match, next to the description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues are introduced in this PR!

0 New issues
0 Security Hotspots
92.3% 92.3% Coverage on New Code
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource merged commit 9985755 into master Oct 31, 2023
16 checks passed
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.

Create rule CSS:S125: Sections of code should not be commented out
2 participants