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

JS-597 Remove dependency on sonar-runtime to determine if rule has secondaries #5160

Merged
merged 6 commits into from
Mar 4, 2025

Conversation

zglicz
Copy link
Contributor

@zglicz zglicz commented Mar 3, 2025

JS-597

First step to remove using 'sonar-runtime' from adding it to rules. Here, we stop depending on it to decode the rule.

We introduce a new property in the rule meta, i.e. SXXXX/meta.ts called hasSecondaries. This will indicate if the rule has the capability to produce secondaryLocations.

@zglicz zglicz requested a review from a team March 3, 2025 14:56
@zglicz zglicz changed the title JS-597 Remove sonar context JS-597 Remove dependency on sonar-runtime to determine if rule has secondaries Mar 4, 2025
schema: [
{
// internal parameter for rules having secondary locations
enum: ['sonar-runtime'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we remove the capability for external custom rules to have secondaries. As far as I see, ucfg's don't use it, architecture doesn't use it.

@@ -26,7 +27,8 @@ public void define(Context context) {
EslintRulesBundle.class,
CustomRulesDefinition.class,
RuleRepository.class,
TsRepository.class
TsRepository.class,
AnalysisMode.class
Copy link
Contributor Author

Choose a reason for hiding this comment

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

without this, locally for me it was crashing

const sonarOptions = {
type: 'string',
enum: [SONAR_RUNTIME, 'metric'], // 'metric' only used by S3776
enum: ['sonar-runtime', 'metric'], // 'metric' only used by S3776
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure why I changed that but in next PR, it will be fully removed.

@ericmorand-sonarsource
Copy link
Contributor

@zglicz,

We introduce a new property in the rule meta, i.e. SXXXX/meta.ts called hasSecondaries. This will indicate if the rule has the capability to produce secondaryLocations.

What is the purpose of this property? If every rule has a property named flow or secondaryLocations, which is an array, doesn't it cover every possible case?

@zglicz
Copy link
Contributor Author

zglicz commented Mar 4, 2025

@ericmorand-sonarsource - we can't easily change all of the rules to be encoded into a common format. We would need to update all of the external rules that call eslint.report directly. At least that's how I see it right now.

@ericmorand-sonarsource
Copy link
Contributor

@zglicz good point, thanks.

@zglicz zglicz merged commit 6c82998 into master Mar 4, 2025
19 of 20 checks passed
@zglicz zglicz deleted the remove-sonar-contex branch March 4, 2025 13:51
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.

3 participants