SonarSource / eslint-plugin-sonarjs

SonarJS rules for ESLint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sonarjs/cognitive-complexity not being detected

mikeharrison-selfridges opened this issue · comments

I want to report a bug.

The sonarjs/cognitive-complexity rule is not being detected inside of my code editor. It is only being caught on the Sonar report
Screenshot 2022-06-07 at 09 43 21

eslint-plugin-sonarjs version: ^0.13.0

eslint version: ^7.32.0

Node.js version: v16.15.0

Rule key: sonarjs/cognitive-complexity

@mikeharrison-selfridges are you aware of SonarLint plugin? Are you using VSCode?

Are you sure you have the same parameter?

Why are you using Sonar along with ESLint?

I can see the same problem, it seems like the algorithm for calculating the complexity is different in the server version and the eslint plugin. In my case I use the default (15 for both the server and the plugin) - should we expect different behaviours or the same?

For example on the server I get six complexity errors, on the clinet I get only two (and they are not included in the server's list).

@vilchik-elena I can tell you why I'm using sonar with eslint; because sonar is a painful tool for frontend development, while eslint is much more mature, but we're mandated on running sonar on the CI. If I can turn off a rule on the server and bring it where it belongs, to the linter "proper", then I'd do that immediately. I could keep on going about eslint and sonar, but I can't see how it is related to the issue at hand.

+1 I got that too.
and I think it should be the same behavior.

This issue has been migrated to Jira. ESLINTJS-23