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

Why complexity is off? #1758

Closed
yeion7 opened this issue Mar 7, 2018 · 4 comments
Closed

Why complexity is off? #1758

yeion7 opened this issue Mar 7, 2018 · 4 comments
Labels

Comments

@yeion7
Copy link

yeion7 commented Mar 7, 2018

Why the rule complexity is off by default?

https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js#L14

@ljharb
Copy link
Collaborator

ljharb commented Mar 7, 2018

In practice, it's not a very useful metric.

@ljharb ljharb added the question label Mar 7, 2018
@yeion7
Copy link
Author

yeion7 commented Mar 7, 2018

Why is not useful?, in teory could evoid complexity, not?

@tunnckoCore
Copy link

tunnckoCore commented Mar 8, 2018

For me, more better metric and more quality code you will get if you combine:

max-params, max-statements, max-statements-per-line, max-nested-callbacks and max-depth.

Don't know how complexity is actually implemented, but above rules are more fine grained and leads you to great code.

In almost my whole life i didn't needed more than 15 statements and 5 nested-callbacks/max-depth - there is always a way to refactor and extract, except some rare scenarios.

@ljharb
Copy link
Collaborator

ljharb commented Mar 8, 2018

@yeion7 that's the theory. In practice, it doesn't really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants