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

Update: Uniform messages for the rules in "complexity" section #11759

Merged
merged 1 commit into from May 25, 2019
Merged

Update: Uniform messages for the rules in "complexity" section #11759

merged 1 commit into from May 25, 2019

Conversation

IgorNovozhilov
Copy link
Contributor

What is the purpose of this pull request? (put an "X" next to item)

What rule do you want to change?

It is proposed to unify the content of messages from the category "complexity". And make them more informative.

Does this change cause the rule to produce more or fewer warnings?

no changed

How will the change be implemented? (New option, new default behavior, etc.)?

  • Changing the message template in exports.meta.messages
  • Changing data in a context.report method call

Please provide some example code that this change will affect:

function test(a) {
  // Comment qwerty qwerty qwerty qwerty
  if (a) {
    if (a) {
      console.log('qwerty');
    }
    a(function() {
      onsole.log('qwerty qwerty');
    })
    a++;a++;a++
    if (a) a(); else a();
  }
}
 
test(a);test(a);

class a {
  
}

class b {
  
}

rules config

  "rules": {
    "complexity": ["warn", 1],
    "max-depth": ["warn", 1],
    "max-len": ["warn", { "code": 30, "comments": 36 }],
    "max-lines": ["warn", 7],
    "max-lines-per-function": ["warn", 5],
    "max-nested-callbacks": ["warn", 0],
    "max-params": ["warn", 0],
    "max-statements": ["warn", 2],
    "max-statements-per-line": ["warn", { "max": 1 }],
    "max-classes-per-file": ["warn", 1]
  }

What does the rule currently do for this code?

изображение

What will the rule do after it's changed?

изображение

What changes did you make? (Give an overview)

complexity, max-depth

  • Added maximum allowed rule value

max-len, max-classes-per-file

  • Added actually rule value

max-lines, max-lines-per-function

  • Uniforming a rule message

Is there anything you'd like reviewers to focus on?

Also I want to change the messages for the rules: max-classes-per-file, max-statements-per-line, and possibly other similar rules that use numeric metrics. Are there any other such rules?

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label May 23, 2019
@IgorNovozhilov
Copy link
Contributor Author

reopen #11695 after #11555

Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@ilyavolodin
Copy link
Member

Marking this as accepted, since previous PR had 3 up-votes, and this one has last one needed.

@ilyavolodin ilyavolodin added accepted There is consensus among the team that this change meets the criteria for inclusion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels May 25, 2019
@ilyavolodin ilyavolodin merged commit 53f7f4c into eslint:master May 25, 2019
@IgorNovozhilov IgorNovozhilov deleted the update-complexity-messages branch May 26, 2019 06:49
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Nov 22, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Nov 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants