Showing 24 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

FileProvider.prototype.loadFromOptions = function(options, callback) {
    if(!this.canLoadFromOptions(options)) {
        throw new Error('No valid options provided for loading translation domains.');
    }

Severity: Major
Found in src/providers/FileProvider.js and 1 other location - About 1 hr to fix
src/providers/StringProvider.js on lines 11..17

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

StringProvider.prototype.loadFromOptions = function(options, callback) {
    if(!this.canLoadFromOptions(options)) {
        throw new Error('No valid options provided for loading translation domains.');
    }
    
Severity: Major
Found in src/providers/StringProvider.js and 1 other location - About 1 hr to fix
src/providers/FileProvider.js on lines 17..23

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          fs.readFile(filePath, readOptions, function(error, data) {
              var parser = _this.poParser;
              if(ext === _this.MO_EXTENSION) {
                  parser = _this.moParser;
              }
      Severity: Major
      Found in src/providers/FileProvider.js and 1 other location - About 1 hr to fix
      src/providers/AjaxProvider.js on lines 52..58

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          this.doRequest(url, binarySource, function(data) {
              var parser = _this.poParser;
              if(type === _this.MO_MIME_TYPE) {
                  parser = _this.moParser;
              }
      Severity: Major
      Found in src/providers/AjaxProvider.js and 1 other location - About 1 hr to fix
      src/providers/FileProvider.js on lines 49..56

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      ProviderFactory.prototype.createFileProvider = function() {
          return new FileProvider(this.parserFactory.createPoParser(),
                                  this.parserFactory.createMoParser());
      };
      Severity: Minor
      Found in src/providers/ProviderFactory.js and 1 other location - About 45 mins to fix
      src/providers/ProviderFactory.js on lines 18..21

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          ProviderFactory.prototype.createAjaxProvider = function () {
              return new AjaxProvider(this.parserFactory.createPoParser(),
                                      this.parserFactory.createMoParser());
          };
          Severity: Minor
          Found in src/providers/ProviderFactory.js and 1 other location - About 45 mins to fix
          src/providers/ProviderFactory.js on lines 29..32

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          FileProvider.prototype.canLoadFromOptions = function(options) {
              return options.mode === 'file' && 'domain' in options && 'path' in options;
          };
          Severity: Minor
          Found in src/providers/FileProvider.js and 1 other location - About 40 mins to fix
          src/providers/StringProvider.js on lines 6..8

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          StringProvider.prototype.canLoadFromOptions = function(options) {
              return options.mode === 'string' && 'domain' in options && 'data' in options;
          };
          Severity: Minor
          Found in src/providers/StringProvider.js and 1 other location - About 40 mins to fix
          src/providers/FileProvider.js on lines 13..15

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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 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

              Severity
              Category
              Status
              Source
              Language