Naxmeify/nloc

View on GitHub

Showing 7 of 7 total issues

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

exports = module.exports = function(options, done) {
  if(options && options.target) {
    if(!exports.isAbsolute(options.target)) {
      options.target = path.resolve(process.cwd(), options.target);
    }
Severity: Minor
Found in lib/nloc.js - About 4 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 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports = module.exports = function(options, done) {
  if(options && options.target) {
    if(!exports.isAbsolute(options.target)) {
      options.target = path.resolve(process.cwd(), options.target);
    }
Severity: Major
Found in lib/nloc.js - About 2 hrs to fix

    Function findInPath has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.findInPath = function(searchPath, config, currentDepth) {
      var foundFiles = {};
    
      // Check Path
      if (!exports.checkPath(searchPath)) {
    Severity: Minor
    Found in lib/nloc.js - About 1 hr to fix

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

      exports.checkPath = function(searchPath, extensions) {
          if(extensions) {
              for(var i in extensions) {
                  var extension = extensions[i];
                  if(fs.existsSync(searchPath+extension)) {
      Severity: Minor
      Found in lib/nloc.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

      TODO found
      Open

                // TODO: implement calculate summary
      Severity: Minor
      Found in lib/nloc.js by fixme

      TODO found
      Open

        // TODO Implementation to get LOC
      Severity: Minor
      Found in lib/nloc.js by fixme

      TODO found
      Open

        // TODO: other analytics
      Severity: Minor
      Found in lib/nloc.js by fixme
      Severity
      Category
      Status
      Source
      Language