Risto-Stevcev/yumparse

View on GitHub
src/yumparse.js

Summary

Maintainability
F
4 days
Test Coverage

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

        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

            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

              There are no issues that match your filters.

              Category
              Status