parroit/crafter

View on GitHub

Showing 22 of 26 total issues

Function exports has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(targetPath, exports) {
    var modules = [];
    var builder;
    var exportsIds = {};
    exports = exports || [];
Severity: Minor
Found in lib/ast-body-concat.js - About 3 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 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(targetPath, exports) {
    var modules = [];
    var builder;
    var exportsIds = {};
    exports = exports || [];
Severity: Major
Found in lib/ast-body-concat.js - About 2 hrs to fix

    Function astRequireFinder has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function astRequireFinder (options){
        return function (node) {
            //jshint validthis:true
            var file = this;
    
    Severity: Major
    Found in lib/ast-require-finder.js - About 2 hrs to fix

      Function end has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          }, function end() {
              var stream = this;
      
              if (cachedTemplate) {
                  applyTemplate(cachedTemplate);
      Severity: Minor
      Found in lib/ast-body-concat.js - About 1 hr to fix

        Function repipeRequirement has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function repipeRequirement(adapter) {
            var builder;
            return through2.obj(function loadRequired(file, enc, next) {
                if (!file.requires) {
                    this.push(file);
        Severity: Minor
        Found in lib/repipe-requirement.js - About 1 hr to fix

          Function createBundle has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function createBundle(output, sourceFileGlob) {
              var outputPath = path.resolve(process.cwd(), output);
              winston.info('Reading source files ', sourceFileGlob);
              winston.info('Writing result to ', outputPath);
          
          Severity: Minor
          Found in bin/crafter-bundle.js - About 1 hr to fix

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

                return through2.obj(function loadRequired(file, enc, next) {
                    if (!file.requires) {
                        this.push(file);
                        return next();
                    }
            Severity: Minor
            Found in lib/repipe-requirement.js - About 1 hr to fix

              Function astVisitor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function astVisitor(visitors) {
                  if (typeof visitors === 'function') {
                      visitors = [visitors];
                  }
                  return through2.obj(function visit(file, enc, next) {
              Severity: Minor
              Found in lib/ast-visitor.js - About 1 hr to fix

                Function repipeRequirement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function repipeRequirement(adapter) {
                    var builder;
                    return through2.obj(function loadRequired(file, enc, next) {
                        if (!file.requires) {
                            this.push(file);
                Severity: Minor
                Found in lib/repipe-requirement.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 astParser has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function astParser(options) {
                    options = options || {loc:true};
                    options.loc = 'loc' in options ? options.loc :  true;
                    options.parsers = options.parsers || {
                        js: parseJs,
                Severity: Minor
                Found in lib/ast-parser.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 applyTemplate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function applyTemplate(template) {
                            try {
                                var file = new File({
                                    path: targetPath
                                });
                Severity: Minor
                Found in lib/ast-body-concat.js - About 1 hr to fix

                  Function runProgram has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function runProgram(er, data) {
                      if (er) {
                          winston.error('There was an error reading the file ' + packagePath + '\n\n' + er.stack);
                          return;
                      }
                  Severity: Minor
                  Found in bin/crafter.js - About 1 hr to fix

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

                    function astParser(options) {
                        options = options || {loc:true};
                        options.loc = 'loc' in options ? options.loc :  true;
                        options.parsers = options.parsers || {
                            js: parseJs,
                    Severity: Minor
                    Found in lib/ast-parser.js - About 1 hr to fix

                      Function astVisitor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function astVisitor(visitors) {
                          if (typeof visitors === 'function') {
                              visitors = [visitors];
                          }
                          return through2.obj(function visit(file, enc, next) {
                      Severity: Minor
                      Found in lib/ast-visitor.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 visit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          return through2.obj(function visit(file, enc, next) {
                              var _this = this;
                              winston.verbose('astVisitor -> ', file && file.path);
                              if (file.isNull()) {
                                  _this.push(file); // pass along
                      Severity: Minor
                      Found in lib/ast-visitor.js - About 1 hr to fix

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

                        function assignModuleId() {
                            var id = 0;
                            var allFiles = [];
                            return through(function write(file) {
                                
                        Severity: Minor
                        Found in lib/assign-module-id.js - About 1 hr to fix

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

                          function modulesBuilder() {
                              var builder = {
                                  rootModules:{},
                                  modules:{},
                                  resolved:{},
                          Severity: Minor
                          Found in lib/modules-builder.js - About 1 hr to fix

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

                                    .pipe(through2.obj(function visit(file, enc, next) {
                                        if (file.isNull()) {
                                            this.push(file); // pass along
                                            return next();
                                        }
                            Severity: Minor
                            Found in bin/crafter-bundle.js - About 1 hr to fix

                              Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                              module.exports = function() {
                                  return through2.obj(function visit(file, enc, next) {
                                      var stream = this;
                              
                                      if (file.isNull()) {
                              Severity: Minor
                              Found in lib/declare-function-wrapper.js - About 35 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 astRequiresReplacer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function astRequiresReplacer(node) {
                                  //jshint validthis:true
                                  var file = this;
                                  if (!file.requires) {
                                      file.requires = {
                              Severity: Minor
                              Found in lib/replace-requires.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

                              Severity
                              Category
                              Status
                              Source
                              Language