codenothing/Nlint

View on GitHub

Showing 26 of 26 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    warnings: function(){
        var self = this;

        self.lint.results.forEach(function( result ) {
            if ( ! result.warnings.length ) {
Severity: Major
Found in lib/Render.js and 1 other location - About 1 day to fix
lib/Render.js on lines 169..189

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 201.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    errors: function(){
        var self = this;

        self.lint.results.forEach(function( result ) {
            if ( ! result.errors.length ) {
Severity: Major
Found in lib/Render.js and 1 other location - About 1 day to fix
lib/Render.js on lines 147..167

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 201.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File Nlint.js has 341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var fs = require( 'fs' ),
    async = require( 'async' ),
    JSON5 = require( 'json5' ),
    child_process = require( 'child_process' ),
    rstartslash = /^\//,
Severity: Minor
Found in lib/Nlint.js - About 4 hrs to fix

    Function update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        update: function( settings, root ) {
            var self = this, list = [];
            root = root || process.cwd();
            settings = settings || {};
    
    
    Severity: Minor
    Found in lib/Settings.js - About 2 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 each has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        each: function( items, fn ) {
            var i, l;
    
            if ( Nlint.isNumber( items ) ) {
                for ( i = -1; ++i < items; ) {
    Severity: Minor
    Found in lib/Util.js - About 2 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 render has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render: function( path, contents, settings, callback ) {
            var errors = [],
                checker = new JSCS(),
                results = [],
                lines = contents.trim().split( rnewline ),
    Severity: Major
    Found in lib/linters/jscs.js - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  JSHint.errors.forEach(function( e ) {
                      errors.push({
                          path: path,
                          message: e.reason,
                          line: e.line,
      Severity: Major
      Found in lib/linters/jshint.js and 1 other location - About 1 hr to fix
      lib/linters/csslint.js on lines 13..21

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 73.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  report.messages.forEach(function( e ) {
                      errors.push({
                          path: path,
                          message: e.message,
                          line: e.line,
      Severity: Major
      Found in lib/linters/csslint.js and 1 other location - About 1 hr to fix
      lib/linters/jshint.js on lines 19..27

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 73.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function update has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          update: function( settings, root ) {
              var self = this, list = [];
              root = root || process.cwd();
              settings = settings || {};
      
      
      Severity: Minor
      Found in lib/Settings.js - About 1 hr to fix

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

        function Linter( path ) {
            var self = this, result, settings,
                current = Nlint.Linters.filter(function( linter ) {
                    return linter.path === path;
                });
        Severity: Minor
        Found in lib/Linter.js - About 1 hr to fix

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

          Nlint.extend = function(){
              var args = Slice.call( arguments ), i = -1, l = args.length, deep = false, target = this, name, copy;
          
              // Check for deep copy
              if ( Nlint.isBoolean( args[ 0 ] ) ) {
          Severity: Minor
          Found in lib/Util.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 run has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              run: function( callback ) {
                  var self = this;
          
                  // Start processing each file
                  async.each(
          Severity: Minor
          Found in lib/Nlint.js - About 1 hr to fix

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

            function Linter( path ) {
                var self = this, result, settings,
                    current = Nlint.Linters.filter(function( linter ) {
                        return linter.path === path;
                    });
            Severity: Minor
            Found in lib/Linter.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 finished has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                finished: function( e ) {
                    var self = this,
                        passed = false,
                        warn = false,
                        error = false;
            Severity: Minor
            Found in lib/Render.js - About 1 hr to fix

              Function _runLint has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _runLint: function( result, settings, linter, callback ){
                      var self = this,
              
                          // We have to create a copy of the options used for each linter in case
                          // the linter itself alters the options
              Severity: Minor
              Found in lib/Nlint.js - About 1 hr to fix

                Function forks has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    forks: function(){
                        var self = this;
                
                        if ( self._forks.length ) {
                            return;
                Severity: Minor
                Found in lib/Nlint.js - About 1 hr to fix

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

                  function Nlint( files, options, callback ) {
                      var self = this;
                  
                      // Force Nlint instance
                      if ( ! ( self instanceof Nlint ) ) {
                  Severity: Minor
                  Found in lib/Nlint.js - About 1 hr to fix

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

                        _renderNodelint: function( path, callback ) {
                            var self = this;
                    
                            // Read contents and store them
                            fs.stat( path, function( e, stat ) {
                    Severity: Minor
                    Found in lib/Nlint.js - About 1 hr to fix

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

                          regexPath: (function(){
                              var rdot = /\./g,
                                  rstar = /\*/g,
                                  rquot = /'/g,
                                  rdquot = /"/g,
                      Severity: Minor
                      Found in lib/Util.js - About 1 hr to fix

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

                            passed: function(){
                                var self = this;
                        
                                self.lint.results
                                    .sort(function( a, b ) {
                        Severity: Minor
                        Found in lib/Render.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language