Risto-Stevcev/yumparse

View on GitHub

Showing 16 of 16 total issues

Function Parser has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
Open

exports.Parser = function(args) {
  'use strict';

  /**
   * Creates a YumparseError
Severity: Minor
Found in src/yumparse.js - About 1 day 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 Parser has 283 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.Parser = function(args) {
  'use strict';

  /**
   * Creates a YumparseError
Severity: Major
Found in src/yumparse.js - About 1 day to fix

    Function parse has 125 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      this.parse = function() {
        /** 
         * Adds a parsed option (see: {@link module:yumparse.Parser#parse})
         * @inner
         * @private
    Severity: Major
    Found in src/yumparse.js - About 5 hrs to fix

      File yumparse.js has 289 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * @module yumparse
       * @author Risto Stevcev
       */
      var mustache = require('mustache');
      Severity: Minor
      Found in src/yumparse.js - About 2 hrs to fix

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

          andFlags: function() {
            'use strict';
            var args = Array.prototype.slice.call(arguments);
            return {
              message: function() {
        Severity: Major
        Found in src/rules.js and 1 other location - About 2 hrs to fix
        src/rules.js on lines 72..83

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

        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

          fileExists: function() {
            'use strict';
            var args = Array.prototype.slice.call(arguments);
            return {
              message: function() {
        Severity: Major
        Found in src/rules.js and 1 other location - About 2 hrs to fix
        src/rules.js on lines 46..57

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

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

        module.exports = function(grunt) {
          grunt.loadNpmTasks('grunt-contrib-clean');
          grunt.loadNpmTasks('grunt-contrib-jshint');
          grunt.loadNpmTasks('grunt-jsdoc');
          grunt.loadNpmTasks('grunt-mocha-istanbul');
        Severity: Major
        Found in Gruntfile.js - About 2 hrs to fix

          Function typeCheck has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              (function typeCheck() {
                Object.keys(this.parsedOptions).forEach(function(flag) {
                  var option = this.parsedOptions[flag];
                  
                  switch (option.type) {
          Severity: Major
          Found in src/yumparse.js - About 2 hrs to fix

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

              var parseOptions = function(options) {
                var flags = {};
                options.forEach(function(option) {
                  if (!option.shortFlag || !option.type || !option.description) {
                    throw new YumparseError('Parser object requires a flag that has at least ' + 
            Severity: Minor
            Found in src/yumparse.js - About 1 hr to fix

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

              try {
                parser.parse();
              }
              catch (e) {
                console.error(e.name + ': ' + e.message);
              Severity: Major
              Found in examples/greeting.js and 2 other locations - About 1 hr to fix
              examples/base64.js on lines 30..36
              examples/temperature.js on lines 36..42

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

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

              try {
                parser.parse();
              }
              catch (e) {
                console.error(e.name + ': ' + e.message);
              Severity: Major
              Found in examples/temperature.js and 2 other locations - About 1 hr to fix
              examples/base64.js on lines 30..36
              examples/greeting.js on lines 22..28

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

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

              try {
                parser.parse();
              }
              catch (e) {
                console.error(e.name + ': ' + e.message);
              Severity: Major
              Found in examples/base64.js and 2 other locations - About 1 hr to fix
              examples/greeting.js on lines 22..28
              examples/temperature.js on lines 36..42

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

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

                  (function collectFlags() {
                    var flag, flagValue;
                    var args = process.argv.slice(2);
                    args.forEach(function(arg) {
                      var isFlag = arg.match(/^-[a-z]$/) || arg.match(/^--[-a-z]*$/);
              Severity: Minor
              Found in src/yumparse.js - About 1 hr to fix

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

                  fileExists: function(flags) {
                    'use strict';
                    return flags.every(function(flag) {
                      var option = this.options[this.flagToName(flag)];
                      if (option.value !== undefined) {
                Severity: Minor
                Found in src/helpers.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

                if (parser.parsedOptions.f)
                  console.log('The array contents: ' + JSON.stringify(parser.parsedOptions.f.value));
                Severity: Minor
                Found in examples/array.js and 1 other location - About 35 mins to fix
                examples/object.js on lines 18..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 47.

                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

                if (parser.parsedOptions.f)
                  console.log('The object contents: ' + JSON.stringify(parser.parsedOptions.f.value));
                Severity: Minor
                Found in examples/object.js and 1 other location - About 35 mins to fix
                examples/array.js on lines 18..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 47.

                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