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

Improve 'no-identical-functions': add option for min function size #325

Merged
merged 3 commits into from
Feb 15, 2022

Conversation

vilchik-elena
Copy link
Contributor

Fixes #225

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good to me overall, but there is one thing we need to investigate before I can approve.

Comment on lines 40 to 45
anyOf: [
{ type: 'integer', minimum: 3 },
{
enum: ['sonar-runtime'],
},
],

Choose a reason for hiding this comment

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

I am not sure, but we need to test locally if this anyOf property will still work with the following logic in SonarJS:

https://github.com/SonarSource/SonarJS/blob/55324ff203c52d325c49b45434e6112551d59fb1/eslint-bridge/src/linter.ts#L332-L357

Copy link
Contributor Author

Choose a reason for hiding this comment

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

definitely it will not:) good catch. I will see what I can do

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 reverted the change with anyOf. We will have to update configuration of the rule in SonarJS.
I don't see other way :(

Choose a reason for hiding this comment

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

👍

enum: ['sonar-runtime'],
},
],
schema: [OPTION_SCHEMA, OPTION_SCHEMA],

Choose a reason for hiding this comment

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

Did you figure out why we need it twice ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, each repetition is a choice between two options so that you can provide them in any order

@sonarcloud
Copy link

sonarcloud bot commented Feb 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

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

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource merged commit 792914a into master Feb 15, 2022
@yassin-kammoun-sonarsource yassin-kammoun-sonarsource changed the title improve 'no-identical-functions': add option for min function size Improve 'no-identical-functions': add option for min function size Feb 18, 2022
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.

Minimum required functions line of rule no-identical-functions can be configured
2 participants