Showing 67 of 71 total issues
Function format
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
format(value, format, lng, options = {}) {
const formats = format.split(this.formatSeparator);
const result = formats.reduce((mem, f) => {
const { formatName, formatOptions } = parseFormatStr(f);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function deepFindWithDefaults
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
data,
defaultData,
key,
keySeparator = '.',
ignoreJSONStructure = true,
Function handle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
handle(processors, value, key, options, translator) {
Function 8
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
8: function(n) {return Number((n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3);},
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function 21
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
21: function(n) {return Number(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0); },
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getRule
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getRule(code, options = {}) {
if (this.shouldUseIntlApi()) {
try {
return new Intl.PluralRules(getCleanedCode(code === 'dev' ? 'en' : code), { type: options.ordinal ? 'ordinal' : 'cardinal' });
} catch (err) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function looksLikeObjectPath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function looksLikeObjectPath(key, nsSeparator, keySeparator) {
nsSeparator = nsSeparator || '';
keySeparator = keySeparator || '';
const possibleChars = chars.filter(
(c) => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function dir
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
dir(lng) {
if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
if (!lng) return 'rtl';
const rtlLngs = [
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function 22
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
22: function(n) {return Number(n==1 ? 0 : n==2 ? 1 : (n<0 || n>10) && n%10==0 ? 2 : 3); }
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return returnSuffix();
Avoid too many return
statements within this function. Open
if (!this.services.backendConnector.backend || (this.options.resources && !this.options.partialBundledLanguages)) return true;
Avoid too many return
statements within this function. Open
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
Avoid too many return
statements within this function. Open
return resolved;
Avoid too many return
statements within this function. Open
return res;
Avoid too many return
statements within this function. Open
return key;
Avoid too many return
statements within this function. Open
return r;
Avoid too many return
statements within this function. Open
if (this.hasResourceBundle(lng, ns)) return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
Avoid too many return
statements within this function. Open
return resolved;