Showing 16 of 24 total issues

Function parseEntry has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

PoParser.prototype.parseEntry = function(entry) {
    var flags, context, key, value, pluralKey, pluralValues;
    flags = pluralValues = [];
    context = key = value = pluralKey = null;

Severity: Minor
Found in src/parsers/PoParser.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 parseEntry has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

PoParser.prototype.parseEntry = function(entry) {
    var flags, context, key, value, pluralKey, pluralValues;
    flags = pluralValues = [];
    context = key = value = pluralKey = null;

Severity: Minor
Found in src/parsers/PoParser.js - About 1 hr to fix

    Function exports has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(grunt) {
        grunt.initConfig({
            pkg: grunt.file.readJSON('package.json'),
            browserify: {
                all: {
    Severity: Minor
    Found in Gruntfile.js - About 1 hr to fix

      Function getTranslation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      Translator.prototype.getTranslation = function(domain, context, key, hasPlural) {
          if(this.domains && this.domains.hasDomain(domain)) {
              var domainTranslations = this.domains.getDomain(domain);
              if(domainTranslations.hasTranslation(key)) {
                  var keyTranslations = domainTranslations.getTranslations(key);
      Severity: Minor
      Found in src/Translator.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 load has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      LinkProvider.prototype.load = function (defaultDomain, callback) {
          var links = this.getValidLinks();
          var callbacksRemaining = links.length;
          var domainCollection = new DomainCollection();
          var adapterCallback = function(partialDomainCollection) {
      Severity: Minor
      Found in src/providers/LinkProvider.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 translate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      Translator.prototype.translate = function() {
          var args = Array.prototype.slice.call(arguments);
          if(args.length > 0) {
              // Check, if placeholder values were passed
              var stringArgsLength = args.length;
      Severity: Minor
      Found in src/Translator.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 Translation has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function Translation(key, value, context, pluralKey, pluralValues, flags) {
      Severity: Minor
      Found in src/translations/Translation.js - About 45 mins to fix

        Function dcngettext has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        Translator.prototype.dcngettext = function(domain, context, singularKey, pluralKey, numericValue, placeholderValues) {
        Severity: Minor
        Found in src/Translator.js - About 45 mins to fix

          Function Translation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function Translation(key, value, context, pluralKey, pluralValues, flags) {
              if(!key) {
                  throw new Error('Key of the translation has to be provided.');
              }
              if(!pluralValues) {
          Severity: Minor
          Found in src/translations/Translation.js - About 45 mins 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 dngettext has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          Translator.prototype.dngettext = function(domain, singularKey, pluralKey, numericValue, placeholderValues) {
          Severity: Minor
          Found in src/Translator.js - About 35 mins to fix

            Function cngettext has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            Translator.prototype.cngettext = function(context, singularKey, pluralKey, numericValue, placeholderValues) {
            Severity: Minor
            Found in src/Translator.js - About 35 mins to fix

              Function readStrings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              MoParser.prototype.readStrings = function(dataView, length, offset) {
                  // Read complete string length into buffer
                  var buffer = dataView.getBytes(length, offset);
              
                  // Check, if the buffer contains multiple strings separated by NULL or EOT bytes.
              Severity: Minor
              Found in src/parsers/MoParser.js - About 35 mins 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 doRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              AjaxProvider.prototype.doRequest = function(url, binarySource, callback) {
                  var request = new XMLHttpRequest();
                  request.open('GET', url, true);
                  if(binarySource) {
                      request.responseType = "arraybuffer";
              Severity: Minor
              Found in src/providers/AjaxProvider.js - About 35 mins 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 extractText has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              PoParser.prototype.extractText = function(lines, startLine, charOffset) {
                  var line = lines[startLine];
                  if(line.substring(charOffset) === '""') {
                      // Multi-line text
                      var text = "";
              Severity: Minor
              Found in src/parsers/PoParser.js - About 35 mins 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 evalPluralFormDefinition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              Translator.prototype.evalPluralFormDefinition = function(n, pluralFormDefinition) {
                  var nplurals, plural;
                  try {
                      // eslint-disable-next-line no-eval
                      eval(pluralFormDefinition);
              Severity: Minor
              Found in src/Translator.js - About 25 mins 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 createTranslation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              MoParser.prototype.createTranslation = function(originalStrings, translatedStrings) {
                  var key, value, context, pluralKey, pluralValues;
              
                  // Extract context
                  if((originalStrings.length === 3 && translatedStrings.length > 1) ||
              Severity: Minor
              Found in src/parsers/MoParser.js - About 25 mins 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