Skip to content

Conversation

@loris-s-sonarsource
Copy link
Contributor

@loris-s-sonarsource loris-s-sonarsource commented Nov 12, 2025

JS-824

Part of

@loris-s-sonarsource loris-s-sonarsource self-assigned this Nov 12, 2025
@loris-s-sonarsource loris-s-sonarsource added the type: new rule Creating a new rule not existing before label Nov 12, 2025
@zglicz
Copy link
Contributor

zglicz commented Nov 13, 2025

Hi @loris-s-sonarsource - I think you need to sync rspec with your new rule in order for all of the build to work.
For this workflow, we have a script to help with generating the boilerplate tools/new-rule.mts. Although, I think you might get away with just syncing the rspec (as this drives the generated SXXXX java classes).

EDIT: As written in chat, the rspec metadata.json is missing the compatibleLanguages field

@zglicz
Copy link
Contributor

zglicz commented Nov 14, 2025

@loris-s-sonarsource - you need to add the compatibleLanguages into the rspec file - https://github.com/SonarSource/rspec/blob/master/rules/S7639/javascript/metadata.json

The jsons in the SonarJS repo will be copied over from rspec automatically.

@loris-s-sonarsource
Copy link
Contributor Author

loris-s-sonarsource commented Nov 14, 2025

@zglicz ohhhh ok thank you !! I thought I could trick the system by directly uploading a correct json to this PR before merging my rspec PR

@zglicz
Copy link
Contributor

zglicz commented Nov 14, 2025

@zglicz ohhhh ok thank you !! I thought I could trick the system by directly uploading a correct json to this PR before merging my rspec PR

No, sadly we cannot do that! Ideally, we wouldn't even store these json and htmls in git and just generate them on the fly. However, there are some tools like the rules.sonarsource.com or the rspec.sonar page that look into this exact folder from the git repo and expect these files to be present there. If they looked at the jar we would be fine, but they clone the repo and expect them tracked there.

@loris-s-sonarsource
Copy link
Contributor Author

A test is broken, but it seems that it's because of Next:

Error:  Error during SonarScanner Engine execution
java.lang.IllegalStateException: Fail to download plugin [dbdjavafrontend] into /home/runner/.sonar/_tmp/fileCache6122588177309986843.tmp
	at org.sonar.scanner.bootstrap.PluginFiles.downloadBinaryTo(PluginFiles.java:145)
	at org.sonar.scanner.bootstrap.PluginFiles.download(PluginFiles.java:107)
...
Caused by: okhttp3.internal.http2.StreamResetException: stream was reset: INTERNAL_ERROR
	at okhttp3.internal.http2.Http2Stream$FramingSource.read(Http2Stream.kt:398)
	at okhttp3.internal.connection.Exchange$ResponseBodySource.read(Exchange.kt:324)
...

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.

LGTM, but I would recommend adding some sources for ruling tests in its/sources/jsts/custom, and adding the expected findings in its/ruling/src/test/expected/jsts/file-for-rules in lits format. Just to make sure the rule is executed during analysis

@loris-s-sonarsource
Copy link
Contributor Author

Noted, thank you! I am keeping that for my monday actions

@sonarqube-next
Copy link

@loris-s-sonarsource loris-s-sonarsource merged commit 5665691 into master Nov 17, 2025
38 checks passed
@loris-s-sonarsource loris-s-sonarsource deleted the loris/JS-824 branch November 17, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: new rule Creating a new rule not existing before

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants