MattiSG/Watai

View on GitHub

Showing 19 of 19 total issues

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

        if (this.model.config.ignore.length) {
            this.animator.log(
                '⨁ ',
                'cyan',
                'ignored scenario'.count(this.model.config.ignore.length)
Severity: Major
Found in src/view/Runner/Verbose.js and 1 other location - About 3 hrs to fix
src/view/Runner/CLI.js on lines 36..46

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

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

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

        if (this.model.config.ignore.length) {
            this.animator.log(
                '⨁ ',
                'cyan',
                'ignored scenario'.count(this.model.config.ignore.length)
Severity: Major
Found in src/view/Runner/CLI.js and 1 other location - About 3 hrs to fix
src/view/Runner/Verbose.js on lines 37..47

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

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

    showFailure: function showFailure(reason) {
        var description = this.getErrorDescription(reason);
        if (description.title) {    // if we can't give more info, simply don't show anything
            this.animator.log('✘ ', 'warn', description.title, 'warn', process.stderr);
            this.animator.log('  ', 'debug', description.help, 'debug', process.stderr);
Severity: Major
Found in src/view/Runner/CLI.js and 1 other location - About 3 hrs to fix
src/view/Runner/Verbose.js on lines 28..34

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

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

    showFailure: function showFailure(reason) {
        var description = this.getErrorDescription(reason);
        if (description.title) {    // if we can't give more info, simply don't show anything
            this.animator.log('✘ ', 'warn', description.title, 'warn', process.stderr);
            this.animator.log('', 'debug', description.help, 'debug', process.stderr);
Severity: Major
Found in src/view/Runner/Verbose.js and 1 other location - About 3 hrs to fix
src/view/Runner/CLI.js on lines 25..31

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

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

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

        for (var i = 0, l = parts.length; i < l - 1; i++) {
            if (hasOwnProperty.call(source, parts[i]))
                source = source[parts[i]];
            else
                return false;
Severity: Major
Found in src/lib/mootools-additions.js and 1 other location - About 1 hr to fix
src/lib/mootools-additions.js on lines 14..19

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

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

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

        for (var i = 0, l = parts.length; i < l - 1; i++) {
            if (hasOwnProperty.call(source, parts[i]))
                source = source[parts[i]];
            else
                return false;
Severity: Major
Found in src/lib/mootools-additions.js and 1 other location - About 1 hr to fix
src/lib/mootools-additions.js on lines 34..39

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

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

Preprocessor.prototype.processAll = function processAll(args) {
    var result = {
        remaining: []
    };

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

    parseConfig: function parseConfig(config) {
        if (! config.baseURL) {
            var msg = 'No baseURL was found in any "' + SuiteLoader.paths.config + '" file in "' + this.path + '" nor any parent directory';
            winston.loggers.get('load').error(msg);
            throw new ReferenceError(msg);
Severity: Minor
Found in src/controller/SuiteLoader.js - About 1 hr to fix

    Function loadAllFiles has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        loadAllFiles: function loadAllFiles(files) {
            var scenarioFiles            = {},
                componentFiles            = [],
                ignoredScenariosIndices    = this.config.ignore.map(function(index) { return String(index); });    // to allow comparison with parsed indices
    
    
    Severity: Minor
    Found in src/controller/SuiteLoader.js - About 1 hr to fix

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

      Preprocessor.prototype.processAll = function processAll(args) {
          var result = {
              remaining: []
          };
      
      
      Severity: Minor
      Found in src/lib/Preprocessor.js - About 1 hr to fix

        Function loadSteps has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            loadSteps: function loadSteps(stepsArray) {
                var result = [];
        
                for (var stepIndex = 0; stepIndex < stepsArray.length; stepIndex++) {
                    var sourceStep = stepsArray[stepIndex],
        Severity: Minor
        Found in src/model/Scenario.js - About 1 hr to fix

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

                  try {
                      vm.runInContext(componentName + ' = '
                                      + '__components__["' + componentName + '"] = '
                                      + 'new Component("' + componentName + '", '
                                      + '{' + fs.readFileSync(componentFile) + '},'
          Severity: Major
          Found in src/controller/SuiteLoader.js and 2 other locations - About 55 mins to fix
          src/controller/SuiteLoader.js on lines 288..295
          src/controller/SuiteLoader.js on lines 347..357

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

          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 3 locations. Consider refactoring.
          Open

                  try {
                      vm.runInContext(fs.readFileSync(fixtureFile),
                                      this.context,
                                      fixtureFile);
                  } catch (error) {
          Severity: Major
          Found in src/controller/SuiteLoader.js and 2 other locations - About 55 mins to fix
          src/controller/SuiteLoader.js on lines 312..323
          src/controller/SuiteLoader.js on lines 347..357

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

          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 3 locations. Consider refactoring.
          Open

                  try {
                      vm.runInContext('var scenarioContents = {' + fs.readFileSync(scenarioFile) + '};'
                                      + '__scenarios__.push(new Scenario('
                                      + scenarioParams.join(',')
                                      + '));',
          Severity: Major
          Found in src/controller/SuiteLoader.js and 2 other locations - About 55 mins to fix
          src/controller/SuiteLoader.js on lines 288..295
          src/controller/SuiteLoader.js on lines 312..323

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

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

              loadSteps: function loadSteps(stepsArray) {
                  var result = [];
          
                  for (var stepIndex = 0; stepIndex < stepsArray.length; stepIndex++) {
                      var sourceStep = stepsArray[stepIndex],
          Severity: Minor
          Found in src/model/Scenario.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 log has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          CLIanimator.log = function log(prefix, type, message, messageType, out) {
          Severity: Minor
          Found in src/lib/cli-animator-posix.js - About 35 mins to fix

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

                initialize: function init(description, stepsArray, components, config, id) {
            Severity: Minor
            Found in src/model/Scenario.js - About 35 mins to fix

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

                  showStart: function showStart() {
                      this.animator.log('  ' + this.getPaddedId() + ' ┍', 'gray', this.model.description, 'gray');
                  },
              Severity: Minor
              Found in src/view/Scenario/Verbose.js and 1 other location - About 30 mins to fix
              src/view/Scenario/Verbose.js on lines 35..37

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

              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

                  showFailure: function showFailure(reason) {
                      this.animator.log('✘ ' + this.getPaddedId() + ' ┕', 'warn', this.model.description, 'warn');
                  },
              Severity: Minor
              Found in src/view/Scenario/Verbose.js and 1 other location - About 30 mins to fix
              src/view/Scenario/Verbose.js on lines 19..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 45.

              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

              Severity
              Category
              Status
              Source
              Language