Showing 15 of 33 total issues
Function exports
has 206 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
Function _format
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
MessageFormat.prototype._format = function (pattern, values, builderCtx, builderFactory) {
var builder = builderFactory(builderCtx);
var i, len, part, id, value;
for (i = 0, len = pattern.length; i < len; i += 1) {
- 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 compileArgument
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Compiler.prototype.compileArgument = function (element) {
if (existsIn(this.tagNames, element.id)) {
throw new Error('Message has conflicting argument and tag name "' + element.id + '".');
}
Function MessageFormat
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function MessageFormat(message, locales, formats, opts) {
// Parse string messages into an AST.
var ast = typeof message === 'string' ?
MessageFormat.__parse(message) : message;
- 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 pluralRuleFunction
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export default {"locale":"en","pluralRuleFunction":function (n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return n10==1&&n100!=11?"one":n10==2&&n100!=12?"two":n10==3&&n100!=13?"few":"other";return n==1&&v0?"one":"other"}};
- 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 _format
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
MessageFormat.prototype._format = function (pattern, values, builderCtx, builderFactory) {
var builder = builderFactory(builderCtx);
var i, len, part, id, value;
for (i = 0, len = pattern.length; i < len; i += 1) {
Function MessageFormat
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MessageFormat(message, locales, formats, opts) {
// Parse string messages into an AST.
var ast = typeof message === 'string' ?
MessageFormat.__parse(message) : message;
Function append
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
ArrayBuilder.prototype.append = function (element) {
if (typeof element === 'undefined' || element === null) {
return;
}
- 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 compileMessage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Compiler.prototype.compileMessage = function (ast) {
if (!(ast && ast.type === 'messageFormatPattern')) {
throw new Error('Message AST is not of type: "messageFormatPattern"');
}
Function extend
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function extend(obj) {
var sources = Array.prototype.slice.call(arguments, 1),
i, len, source, key;
for (i = 0, len = sources.length; i < len; i += 1) {
- 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 _resolveLocale
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
MessageFormat.prototype._resolveLocale = function (locales) {
if (typeof locales === 'string') {
locales = [locales];
}
- 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 PluralFormat
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function PluralFormat(id, useOrdinal, offset, options, pluralFn) {
Function _compilePattern
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageFormat.prototype._compilePattern = function (ast, locales, formats, pluralFn, opts) {
Avoid too many return
statements within this function. Open
return new SelectFormat(element.id, options);
Avoid too many return
statements within this function. Open
return new PluralFormat(
element.id, format.ordinal, format.offset, options, pluralFn
);