martinheidegger/i18n-core

View on GitHub

Showing 25 of 46 total issues

Function convertToAPI has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

function convertToAPI (node) {
  var api = function __ (key, namedValues, a, b, c, d, e, f, g, h, i, j) {
    if (typeof namedValues === 'object' && namedValues !== null) {
      return ___(node, key, namedValues, a, b, c, d, e, f, g, h, i, j)
    }
Severity: Minor
Found in simple.js - About 4 hrs to fix

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 convertToAPI has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function convertToAPI (node) {
  var api = function __ (key, namedValues, a, b, c, d, e, f, g, h, i, j) {
    if (typeof namedValues === 'object' && namedValues !== null) {
      return ___(node, key, namedValues, a, b, c, d, e, f, g, h, i, j)
    }
Severity: Major
Found in simple.js - About 3 hrs to fix

Function _____n has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

function _____n (node, singular, plural, count, namedValues, args) {
  var keys
  var fallbackKey
  if (count > 1) {
    if (typeof plural === 'object' && plural !== null) {
Severity: Minor
Found in simple.js - About 3 hrs to fix

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 exports has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (folder, strategy) {
  // need to load here, because it needs a mock for testing.
  var fs = require('fs')
  var getRaw = function getRaw (file) {
    try {
Severity: Minor
Found in lookup/fs.js - About 2 hrs to fix

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 i18nChain has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function i18nChain () {
  var first = null
  var current
  for (var i = 0; i < arguments.length; i++) {
    var handler = arguments[i]
Severity: Minor
Found in lookup/chain.js - About 2 hrs to fix

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 exports has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (folder, strategy) {
  // need to load here, because it needs a mock for testing.
  var fs = require('fs')
  var getRaw = function getRaw (file) {
    try {
Severity: Minor
Found in lookup/fs.js - About 1 hr to fix

Function ____n has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

function ____n (node, singular, plural, count, namedValues, a, b, c, d, e, f, g, h, i, j) {
Severity: Major
Found in simple.js - About 1 hr to fix

Function ___n has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

function ___n (node, singular, plural, count, namedValues, a, b, c, d, e, f, g, h, i, j) {
Severity: Major
Found in simple.js - About 1 hr to fix

Function __n has 14 arguments (exceeds 4 allowed). Consider refactoring.
Open

  api.__n = function __n (singular, plural, count, namedValues, a, b, c, d, e, f, g, h, i, j) {
Severity: Major
Found in simple.js - About 1 hr to fix

Function absN has 14 arguments (exceeds 4 allowed). Consider refactoring.
Open

  api.absN = function absN (singular, plural, count, namedValues, a, b, c, d, e, f, g, h, i, j) {
Severity: Major
Found in simple.js - About 1 hr to fix

Function _____n has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function _____n (node, singular, plural, count, namedValues, args) {
  var keys
  var fallbackKey
  if (count > 1) {
    if (typeof plural === 'object' && plural !== null) {
Severity: Minor
Found in simple.js - About 1 hr to fix

Function ___ has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

function ___ (node, key, namedValues, a, b, c, d, e, f, g, h, i, j) {
Severity: Major
Found in simple.js - About 1 hr to fix

Function i18nChain has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function i18nChain () {
  var first = null
  var current
  for (var i = 0; i < arguments.length; i++) {
    var handler = arguments[i]
Severity: Minor
Found in lookup/chain.js - About 1 hr to fix

Function createNode has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function createNode (prefix, parent, translator, allowModification) {
  var node = Object.create(API)
  node.currentPrefix = prefix
  node.parent = parent
  node.translator = translator
Severity: Minor
Found in lib/createNode.js - About 1 hr to fix

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 abs has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

  api.abs = function abs (key, namedValues, a, b, c, d, e, f, g, h, i, j) {
Severity: Major
Found in simple.js - About 1 hr to fix

Function api has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

  var api = function __ (key, namedValues, a, b, c, d, e, f, g, h, i, j) {
Severity: Major
Found in simple.js - About 1 hr to fix

Function createNode has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createNode (prefix, parent, translator, allowModification) {
  var node = Object.create(API)
  node.currentPrefix = prefix
  node.parent = parent
  node.translator = translator
Severity: Minor
Found in lib/createNode.js - About 1 hr to fix

Function offContextChange has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function offContextChange (type, fn) {
  if (type !== 'contextChange') {
    return
  }
  if (this.listener === fn) {
Severity: Minor
Found in lib/createNode.js - About 1 hr to fix

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 ____n has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function ____n (node, singular, plural, count, namedValues, a, b, c, d, e, f, g, h, i, j) {
  var args
  if (j !== undefined) {
    args = [count, a, b, c, d, e, f, g, h, i, j]
  } else if (i !== undefined) {
Severity: Minor
Found in simple.js - About 1 hr to fix

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 ___ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function ___ (node, key, namedValues, a, b, c, d, e, f, g, h, i, j) {
  var args
  if (j !== undefined) {
    args = [a, b, c, d, e, f, g, h, i, j]
  } else if (i !== undefined) {
Severity: Minor
Found in simple.js - About 1 hr to fix

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

Severity
Category
Status
Source
Language