happyplan/happyplan

View on GitHub

Showing 26 of 28 total issues

Function register has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

module.exports.register = function(Handlebars, options, params) {
  "use strict";

  function eachSorted(context, options, sortCallback, filterCallback) {
    /*jshint validthis:true */
Severity: Minor
Found in src/_helpers/helper-posts.js - About 6 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 getThemeConfig has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function getThemeConfig(grunt, prop, options) {
  "use strict";

  options = options || {}

Severity: Minor
Found in grunt_tasks/lib/get-theme-config.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 prepareThemes has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function prepareThemes(grunt) {
  "use strict";

  var happyplan = grunt.config.getRaw('happyplan')
    , mergeConfig = require('./merge-config')
Severity: Minor
Found in grunt_tasks/lib/prepare-theme.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 exports has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
  "use strict";

  var path = require('path')
    , codeMirrorHighlight = require('highlight-codemirror')
Severity: Minor
Found in grunt_tasks/config/assemble.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 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
  "use strict";

  var path = require('path')
    , codeMirrorHighlight = require('highlight-codemirror')
Severity: Major
Found in grunt_tasks/config/assemble.js - About 3 hrs to fix

    Function prepareThemes has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function prepareThemes(grunt) {
      "use strict";
    
      var happyplan = grunt.config.getRaw('happyplan')
        , mergeConfig = require('./merge-config')
    Severity: Major
    Found in grunt_tasks/lib/prepare-theme.js - About 2 hrs to fix

      Function register has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.register = function(Handlebars, options, params) {
        "use strict";
      
        function eachSorted(context, options, sortCallback, filterCallback) {
          /*jshint validthis:true */
      Severity: Major
      Found in src/_helpers/helper-posts.js - About 2 hrs to fix

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

        module.exports = function getThemeConfig(grunt, prop, options) {
          "use strict";
        
          options = options || {}
        
        
        Severity: Major
        Found in grunt_tasks/lib/get-theme-config.js - About 2 hrs to fix

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

          module.exports = function(grunt) {
            "use strict";
          
            var fs = require('fs')
              , path = require('path')
          Severity: Minor
          Found in grunt_tasks/config/copy.js - About 1 hr to fix

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

            module.exports = function(grunt) {
              "use strict";
            
              return {
                jsconfig: {
            Severity: Minor
            Found in grunt_tasks/config/watch.js - About 1 hr to fix

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

              module.exports = function(grunt) {
                "use strict";
              
                // Execute or skip 'webfont:glyphicons' depending of the presence of SVG files in the '<%= happyplan.path.assets.glyphicons %>' folder.
                grunt.registerTask('happyplan:glyphicons', 'Generate glyphicons if needed', function() {
              Severity: Minor
              Found in grunt_tasks/glyphicons.js - About 1 hr to fix

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

                module.exports = function(grunt) {
                  "use strict";
                
                  function unquote(str) {
                    if (str.indexOf('"') === 0 && str.lastIndexOf('"') === str.length-1 ||
                Severity: Minor
                Found in grunt_tasks/newpost.js - About 1 hr to fix

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

                    function eachSorted(context, options, sortCallback, filterCallback) {
                      /*jshint validthis:true */
                  
                      var fn = options.fn
                      , i = 0
                  Severity: Minor
                  Found in src/_helpers/helper-posts.js - About 1 hr to fix

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

                            highlight: function (code, lang) {
                              if (lang) {
                                try {
                                  var langs = happyplan.codeHighlightMap[lang] ? happyplan.codeHighlightMap[lang] : [lang]
                                  if (langs.length) {
                    Severity: Minor
                    Found in grunt_tasks/config/assemble.js - About 1 hr to fix

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

                      module.exports = function(grunt) {
                        "use strict";
                      
                        // using try instead of a file.exists also handle json parsing error
                        try {
                      Severity: Minor
                      Found in Gruntfile.js - About 1 hr to fix

                        Function prepareThemes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function prepareThemes(grunt) {
                          "use strict";
                        
                          var happyplan = grunt.config.get('happyplan')
                            , helpers = grunt.config.getRaw(['happyplan', 'html', 'helpers'])
                        Severity: Minor
                        Found in grunt_tasks/lib/hooks.js - About 1 hr to fix

                          Function getThemes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function getThemes(grunt, reverseOrder, raw) {
                            "use strict";
                          
                            reverseOrder = reverseOrder === undefined ? true : reverseOrder;
                            raw = raw === undefined ? false : raw;
                          Severity: Minor
                          Found in grunt_tasks/lib/get-themes.js - About 1 hr to fix

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

                            module.exports = function getThemes(grunt, reverseOrder, raw) {
                              "use strict";
                            
                              reverseOrder = reverseOrder === undefined ? true : reverseOrder;
                              raw = raw === undefined ? false : raw;
                            Severity: Minor
                            Found in grunt_tasks/lib/get-themes.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

                            Avoid deeply nested control flow statements.
                            Open

                                  else if (finalValue) {
                                    //if (value instanceof Array) {
                                      value.push(finalValue)
                                      finalValue = value
                                    // }
                            Severity: Major
                            Found in grunt_tasks/lib/get-theme-config.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                      if (value instanceof Object) {
                                        for(i in value) {
                                          theme[i] = custom[i]
                                        }
                                        finalValue = value.concat(finalValue)
                              Severity: Major
                              Found in grunt_tasks/lib/get-theme-config.js - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language