Xiphe/Thrall

View on GitHub

Showing 22 of 22 total issues

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

/* jshint ignore: line */module.exports = function(
  thrallConfig,
  path,
  grunt,
  glob,
Severity: Major
Found in lib/mergeGruntPluginConfig.js - About 5 hrs to fix

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

    /* jshint ignore: line */module.exports = function(
      thrallConfig,
      path,
      grunt,
      glob,
    Severity: Minor
    Found in lib/mergeGruntPluginConfig.js - About 5 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 initConfig has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function initConfig(grunt) {
      grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        srcFiles: 'lib/*.js',
        testFiles: [
    Severity: Major
    Found in gruntfile.js - About 3 hrs to fix

      Function taskFactory has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function taskFactory(
        thrallConfig,
        grunt,
        mergeGruntPluginConfig,
        applyTaskOptions,
      Severity: Major
      Found in lib/task.js - About 2 hrs to fix

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

        module.exports = function(_, grunt, cliOptions) {
          'use strict';
        
          /** @const */
          var OPTION_TYPE_ARRAY = 'array';
        Severity: Minor
        Found in lib/applyTaskOptions.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 exports has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(_, grunt, cliOptions) {
          'use strict';
        
          /** @const */
          var OPTION_TYPE_ARRAY = 'array';
        Severity: Major
        Found in lib/applyTaskOptions.js - About 2 hrs to fix

          Function initFactory has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function initFactory(
            thrallConfig,
            path,
            grunt,
            loadGruntPlugins,
          Severity: Major
          Found in lib/init.js - About 2 hrs to fix

            Function initFactory has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function initFactory(
              thrallConfig,
              path,
              grunt,
              loadGruntPlugins,
            Severity: Minor
            Found in lib/init.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 addTaskFactory has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function addTaskFactory(
              task,
              baseInjector,
              thrallConfig,
              grunt,
            Severity: Minor
            Found in lib/addTasks.js - About 2 hrs to fix

              Function exports has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                task,
                baseInjector,
                thrallConfig,
                grunt,
                glob,
              Severity: Major
              Found in lib/addTasks.js - About 1 hr to fix

                Function loadGruntPluginsFactory has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function loadGruntPluginsFactory(
                  thrallConfig,
                  grunt,
                  findupSync,
                  path,
                Severity: Minor
                Found in lib/loadGruntPlugins.js - About 1 hr to fix

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

                    function getSubConfig(tokens, subtaskInjector) {
                      var subConfigPath = path.join.apply(
                        path,
                        [thrallConfig.dir, CONFIG_DIR].concat(tokens)
                      );
                  Severity: Minor
                  Found in lib/mergeGruntPluginConfig.js - About 1 hr to fix

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

                      function addTasks(tasks) {
                        if (!_.isArray(tasks) || !tasks.length) {
                          tasks = getTasks();
                        }
                    
                    
                    Severity: Minor
                    Found in lib/addTasks.js - About 1 hr to fix

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

                        return function loadGruntPlugins() {
                          grunt.verbose.subhead(
                            'loading grunt plugins for "' + thrallConfig.name + '"...'
                          );
                      
                      
                      Severity: Minor
                      Found in lib/loadGruntPlugins.js - About 1 hr to fix

                        Function exports has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          thrallConfig,
                          path,
                          grunt,
                          loadGruntPlugins,
                          addTasks,
                        Severity: Major
                        Found in lib/init.js - About 50 mins to fix

                          Function exports has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            thrallConfig,
                            path,
                            grunt,
                            glob,
                            _,
                          Severity: Major
                          Found in lib/mergeGruntPluginConfig.js - About 50 mins to fix

                            Function exports has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              thrallConfig,
                              grunt,
                              mergeGruntPluginConfig,
                              applyTaskOptions,
                              _,
                            Severity: Minor
                            Found in lib/task.js - About 45 mins to fix

                              Function exports has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                thrallConfig,
                                grunt,
                                findupSync,
                                path,
                                _
                              Severity: Minor
                              Found in lib/loadGruntPlugins.js - About 35 mins to fix

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

                                    if (!thrallConfig.dir) {
                                      throw new Error('Thall is missing a dir.');
                                    } else {
                                      thrallConfig.dir = path.resolve(thrallConfig.dir);
                                    }
                                Severity: Minor
                                Found in lib/init.js and 1 other location - About 35 mins to fix
                                lib/init.js on lines 19..23

                                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 47.

                                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

                                    if (!thrallConfig.basePath) {
                                      throw new Error('Thall is missing a basePath.');
                                    } else {
                                      thrallConfig.basePath = path.resolve(thrallConfig.basePath);
                                    }
                                Severity: Minor
                                Found in lib/init.js and 1 other location - About 35 mins to fix
                                lib/init.js on lines 13..17

                                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 47.

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language