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-255 Restore cognitive complexity calculation at file level #4833

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

yassin-kammoun-sonarsource
Copy link
Contributor

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource commented Sep 19, 2024

The complexity calculation at file level is restored to its previous state the SonarJS ESLint plugin before this change. However, when the rule is activated for cognitive complexity at the function level, the new behavior for a nesting function that does not account for its nested function's complexity is preserved. The RSPEC of the rule was also slightly improved.

It might not be obvious to review this PR. I think that the changes on the unit test assertions and the absence of changes in the ruling is proof enough that everything is working as it should. Therefore, reviewing those might be enough.

Last but not least, I think the rule should be implemented from scratch as it's becoming quite difficult to understand what it actually does. However, I suggest we postpone this to later and create a ticket for this.

Copy link

sonarqube-next bot commented Sep 19, 2024

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource requested a review from a team September 19, 2024 15:56
Copy link
Contributor

@zglicz zglicz left a comment

Choose a reason for hiding this comment

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

In general makes sense. The unit.test also seems to get an increased count, which gives more confidence as well.

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource merged commit f4e17fc into master Sep 20, 2024
15 of 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.

2 participants