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

Ignore file size limits for CSS #4316

Merged
merged 4 commits into from Oct 26, 2023
Merged

Ignore file size limits for CSS #4316

merged 4 commits into from Oct 26, 2023

Conversation

ilia-kebets-sonarsource
Copy link
Contributor

Fixes #4234

@@ -180,6 +180,9 @@ void should_exclude_huge_files() {
assertThat(filter.accept(inputFile("name.java", syntheticJavaFileContent(size, "Foo"))))
.withFailMessage("Wrong result for size " + size)
.isTrue();

// we ignore size limits for CSS files
assertThat(filter.accept(inputFile("name.css", syntheticJsFileContent(size)))).isTrue();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reused syntheticJsFileContent(), because the file content doesn't matter here.

@saberduck
Copy link
Contributor

saberduck commented Oct 25, 2023

I would keep assessors agnostic of the language of the file.
I believe this logic should be in the filter itself and not in the assessor, ie here

We should create different set of assessors for CSS and JS/TS files, and simply not include size assessor in the CSS files. Keep in mind that the order of "assessing" matters -> we should do cheap exclusions based on file properties before touching the content of the file.

Copy link
Contributor

@saberduck saberduck left a comment

Choose a reason for hiding this comment

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

see comment above

@sonarqube-next
Copy link

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@ilia-kebets-sonarsource
Copy link
Contributor Author

I was wondering if it is problematic that the filter scope is only covering CssLanguage here contrary to how the CSSRuleSensor filters it.

@saberduck
Copy link
Contributor

I was wondering if it is problematic that the filter scope is only covering CssLanguage here contrary to how the CSSRuleSensor filters it.

IMO, it's okay like this. We don't need to filter html or other files. We can adjust if we discover there is an issue with such setup.

@saberduck saberduck merged commit 09fde3f into master Oct 26, 2023
17 checks passed
@saberduck saberduck deleted the issue-4234/css-max-size branch October 26, 2023 14:09
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.

Fix confusion over sonar.javascript.maxFileSize being applied on CSS files
2 participants