Bug 1436389 - Update complexity rules to adapt for the algorithm in the new ESLint. r?Mossop
MozReview-Commit-ID: 1LlfamNvBEM
--- a/accessible/.eslintrc.js
+++ b/accessible/.eslintrc.js
@@ -1,14 +1,14 @@
"use strict";
module.exports = {
"rules": {
// Warn about cyclomatic complexity in functions.
- "complexity": ["error", 42],
+ "complexity": ["error", 47],
// XXX These are rules that are enabled in the recommended configuration, but
// disabled here due to failures when initially implemented. They should be
// removed (and hence enabled) at some stage.
"consistent-return": "off",
"no-unexpected-multiline": "off",
"no-unsafe-finally": "off",
"no-useless-call": "off",
--- a/browser/.eslintrc.js
+++ b/browser/.eslintrc.js
@@ -1,15 +1,15 @@
"use strict";
module.exports = {
"rules": {
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
// be removed & synced with the mozilla/recommended value.
- "complexity": ["error", {"max": 40}],
+ "complexity": ["error", {"max": 44}],
// Disallow empty statements. This will report an error for:
// try { something(); } catch (e) {}
// but will not report it for:
// try { something(); } catch (e) { /* Silencing the error because ...*/ }
// which is a valid use case.
"no-empty": "error",
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -637,16 +637,17 @@
onProgressChange64(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
return this.onProgressChange(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress,
aMaxTotalProgress);
},
+ /* eslint-disable complexity */
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
if (!aRequest)
return;
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const nsIChannel = Components.interfaces.nsIChannel;
let location, originalLocation;
try {
@@ -838,16 +839,17 @@
nsIWebProgressListener.STATE_STOP)) {
// reset cached temporary values at beginning and end
this.mMessage = "";
this.mTotalProgress = 0;
}
this.mStateFlags = aStateFlags;
this.mStatus = aStatus;
},
+ /* eslint-enable complexity */
onLocationChange(aWebProgress, aRequest, aLocation,
aFlags) {
// OnLocationChange is called for both the top-level content
// and the subframes.
let topLevel = aWebProgress.isTopLevel;
if (topLevel) {
--- a/browser/components/migration/.eslintrc.js
+++ b/browser/components/migration/.eslintrc.js
@@ -1,15 +1,15 @@
"use strict";
module.exports = {
"rules": {
"block-scoped-var": "error",
"comma-dangle": ["error", "always-multiline"],
- "complexity": ["error", {"max": 21}],
+ "complexity": ["error", {"max": 22}],
"indent-legacy": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
"max-nested-callbacks": ["error", 3],
"new-parens": "error",
"no-extend-native": "error",
"no-fallthrough": ["error", { "commentPattern": ".*[Ii]ntentional(?:ly)?\\s+fall(?:ing)?[\\s-]*through.*" }],
"no-multi-str": "error",
"no-return-assign": "error",
"no-sequences": "error",
--- a/browser/extensions/formautofill/.eslintrc.js
+++ b/browser/extensions/formautofill/.eslintrc.js
@@ -53,17 +53,17 @@ module.exports = {
// since only let and const are used, see "no-var").
"block-scoped-var": "error",
// Allow trailing commas for easy list extension. Having them does not
// impair readability, but also not required either.
"comma-dangle": ["error", "always-multiline"],
// Warn about cyclomatic complexity in functions.
- "complexity": ["error", {"max": 20}],
+ "complexity": ["error", {"max": 26}],
// Enforce dots on the next line with property name.
"dot-location": ["error", "property"],
// Maximum length of a line.
// This should be 100 but too many lines were longer than that so set a
// conservative upper bound for now.
"max-len": ["error", 140],
--- a/devtools/.eslintrc.js
+++ b/devtools/.eslintrc.js
@@ -76,17 +76,17 @@ module.exports = {
// start and end braces on the same line.
"brace-style": ["error", "1tbs", {"allowSingleLine": false}],
// Require camel case names
"camelcase": "error",
// Allow trailing commas for easy list extension. Having them does not
// impair readability, but also not required either.
"comma-dangle": "off",
// Warn about cyclomatic complexity in functions.
- "complexity": ["error", 35],
+ "complexity": ["error", 53],
// Don't warn for inconsistent naming when capturing this (not so important
// with auto-binding fat arrow functions).
"consistent-this": "off",
// Enforce curly brace conventions for all control statements.
"curly": "error",
// Don't require a default case in switch statements. Avoid being forced to
// add a bogus default when you know all possible cases are handled.
"default-case": "off",
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -1,11 +1,11 @@
"use strict";
module.exports = {
rules: {
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
// be removed & synced with the mozilla/recommended value.
- "complexity": ["error", 41],
+ "complexity": ["error", 44],
"mozilla/no-task": "error",
}
};
--- a/toolkit/components/passwordmgr/.eslintrc.js
+++ b/toolkit/components/passwordmgr/.eslintrc.js
@@ -1,12 +1,12 @@
"use strict";
module.exports = {
"rules": {
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
// be removed & synced with the mozilla/recommended value.
- "complexity": ["error", 43],
+ "complexity": ["error", 56],
"no-unused-vars": ["error", {"args": "none", "vars": "local", "varsIgnorePattern": "^(ids|ignored|unused)$"}],
}
};
--- a/toolkit/components/satchel/.eslintrc.js
+++ b/toolkit/components/satchel/.eslintrc.js
@@ -4,17 +4,17 @@ module.exports = {
rules: {
"mozilla/balanced-listeners": "error",
"mozilla/var-only-at-top-level": "error",
"array-bracket-spacing": ["error", "never"],
"block-scoped-var": "error",
"comma-dangle": ["error", "always-multiline"],
complexity: ["error", {
- max: 20,
+ max: 23,
}],
curly: ["error", "all"],
"dot-location": ["error", "property"],
"indent-legacy": ["error", 2, {
SwitchCase: 1,
CallExpression: {
arguments: "first",
},
--- a/toolkit/mozapps/extensions/.eslintrc.js
+++ b/toolkit/mozapps/extensions/.eslintrc.js
@@ -1,12 +1,12 @@
"use strict";
module.exports = {
"rules": {
// Warn about cyclomatic complexity in functions.
// XXX Bug 1326071 - This should be reduced down - probably to 20 or to
// be removed & synced with the mozilla/recommended value.
- "complexity": ["error", {"max": 60}],
+ "complexity": ["error", {"max": 68}],
"no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
}
};
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -114,17 +114,17 @@ module.exports = {
// No space before always a space after a comma
"comma-spacing": ["error", {"after": true, "before": false}],
// Commas at the end of the line not the start
"comma-style": "error",
// Warn about cyclomatic complexity in functions.
// XXX Get this down to 20?
- "complexity": ["error", 32],
+ "complexity": ["error", 34],
// Don't require spaces around computed properties
"computed-property-spacing": ["error", "never"],
// Functions must always return something or nothing
"consistent-return": "error",
// Require braces around blocks that start a new line