JLBoor/generator-jlb-angular

View on GitHub
utils.js

Summary

Maintainability
C
1 day
Test Coverage

Function askForDir has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.askForDir = function(type,that,module,ownDir,cb){

    that.module = module;
    that.appname = module.name;
    that.dir = path.dirname(module.file);
Severity: Major
Found in utils.js - About 2 hrs to fix

    Function askForDir has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.askForDir = function(type,that,module,ownDir,cb){
    
        that.module = module;
        that.appname = module.name;
        that.dir = path.dirname(module.file);
    Severity: Minor
    Found in utils.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 dirPromptCallback has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var dirPromptCallback = function (props) {
    
            that.dir = path.join(props.dir,'/');
            var dirToCreate = that.dir;
            if (ownDir){
    Severity: Minor
    Found in utils.js - About 1 hr to fix

      Function getParentModule has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.getParentModule = function(dir){
          //starting this dir, find the first module and return parsed results
          if (fs.existsSync(dir)) {
              var files = fs.readdirSync(dir);
              for (var i = 0; i < files.length; i++) {
      Severity: Minor
      Found in utils.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 processTemplates has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      exports.processTemplates = function(name,dir,type,that,defaultDir,configName,module){
      Severity: Major
      Found in utils.js - About 50 mins to fix

        Function injectRoute has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        exports.injectRoute = function(moduleFile,uirouter,name,route,routeUrl,that){
        Severity: Minor
        Found in utils.js - About 45 mins to fix

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

          exports.askForDir = function(type,that,module,ownDir,cb){
          Severity: Minor
          Found in utils.js - About 35 mins to fix

            Function inject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.inject = function(filename,that,module) {
                //special case to skip unit tests
                if (_(filename).endsWith('.spec.js')) { return; }
            
                if (_(filename).startsWith(APP_FOLDER)) {
            Severity: Minor
            Found in utils.js - About 25 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

            There are no issues that match your filters.

            Category
            Status