msieurtoph/any-packages

View on GitHub

Showing 7 of 9 total issues

Function parseArg has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function parseArg(arg){

    if (!validUrl.isUri(arg) && !arg.match(/^[^\/]+\/[^\/]+$/)) {
        return {
            valid: false,
Severity: Minor
Found in cli.js - About 2 hrs 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 exports has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

Severity: Major
Found in Gruntfile.js - About 2 hrs to fix

    Function parseArg has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function parseArg(arg){
    
        if (!validUrl.isUri(arg) && !arg.match(/^[^\/]+\/[^\/]+$/)) {
            return {
                valid: false,
    Severity: Minor
    Found in cli.js - About 1 hr to fix

      Function run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function run(packages, opts, callback){
      
          // params :
          if (!util.isArray(packages)) {
              packages = 'string' === typeof packages ? packages.split(' ') : [];
      Severity: Minor
      Found in cli.js - About 1 hr to fix

        Function setPkg has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function setPkg(pkg){
        
            pkg.resolvedKey = '_anyPackages';
            pkg.opts = {};
        
        
        Severity: Minor
        Found in lib/package.js - About 1 hr to fix

          Function install has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function install(pkg, opts){
          
              setPkg(pkg);
              pkg.opts = opts || {};
          
          
          Severity: Minor
          Found in lib/package.js - About 1 hr to fix

            Function run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            function run(packages, opts, callback){
            
                // params :
                if (!util.isArray(packages)) {
                    packages = 'string' === typeof packages ? packages.split(' ') : [];
            Severity: Minor
            Found in cli.js - About 55 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