42Zavattas/generator-bangular

View on GitHub
util.js

Summary

Maintainability
A
3 hrs
Test Coverage

Function rewrite has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  rewrite: function (args) {
    // check if splicable is already in the body text
    var re = new RegExp(args.splicable.map(function (line) {
      return '\s*' + escapeRegExp(line);
    }).join('\n'));
Severity: Minor
Found in util.js - About 1 hr to fix

    Function processDirectory has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      processDirectory: function (self, source, destination) {
        var root = isPathAbsolute(source) ? source : path.join(self.sourceRoot(), source);
        var files = glob.sync('**', { dot: true, nodir: true, cwd: root });
        var dest, src;
    
    
    Severity: Minor
    Found in util.js - About 1 hr to fix

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

        appendOnTop: function (opts, cb) {
          fs.readFile(opts.dest, function (err, data) {
            if (err) { return cb(err, null); }
            fs.writeFile(opts.dest, opts.append + '\n', function (err) {
              if (err) { return cb(err, null); }
      Severity: Minor
      Found in util.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

      There are no issues that match your filters.

      Category
      Status