squarewolf/node-neuter

View on GitHub

Showing 9 of 11 total issues

Function loadSource has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Neuter.prototype.loadSource = function(file, done) {
    if (_.isString(file)) {
        this.loadFileGlob(file, (function(err, files) {
            if (err) {
                return done(err);
Severity: Major
Found in lib/neuter.js - About 4 hrs to fix

    NodeTypes has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    var NodeTypes = {
        AssignmentExpression: function (node) {
            return [
                node.left,
                node.right,
    Severity: Minor
    Found in lib/scanner.js - About 3 hrs to fix

      Function exports has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(source, functionName, done) {
      
          var program;
      
          try {
      Severity: Major
      Found in lib/scanner.js - About 3 hrs to fix

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

            function scanNode(node, done) {
                setImmediate(function () {
                    if (NodeTypes[node.type] === undefined) {
                        return done(null, []);
                    }
        Severity: Major
        Found in lib/scanner.js - About 2 hrs to fix

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

          Neuter.prototype.generateSourceNode = function(sections) {
              var sourceNode = new sourceMap.SourceNode(null, null, null);
          
              var beforeOffset = 0;
              var afterOffset = 0;
          Severity: Minor
          Found in lib/neuter.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 generateSourceNode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Neuter.prototype.generateSourceNode = function(sections) {
              var sourceNode = new sourceMap.SourceNode(null, null, null);
          
              var beforeOffset = 0;
              var afterOffset = 0;
          Severity: Minor
          Found in lib/neuter.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (argument[0] === '.') {
                                        // the path is relative to the current file,
                                        // prefix with the file's base path
                                        argument = path.join(path.dirname(file.path), argument);
                                    }
            Severity: Major
            Found in lib/neuter.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for (var i = 0; i < childNode.arguments.length; i++) {
                                          var argument = childNode.arguments[i];
                                          if (argument.type !== 'Literal') {
                                              return done(new Error('Unsupported require argument type: ' + argument.type));
                                          }
              Severity: Major
              Found in lib/scanner.js - About 45 mins to fix

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

                Neuter.prototype.loadSource = function(file, done) {
                    if (_.isString(file)) {
                        this.loadFileGlob(file, (function(err, files) {
                            if (err) {
                                return done(err);
                Severity: Minor
                Found in lib/neuter.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

                Severity
                Category
                Status
                Source
                Language