Gottwik/Enduro

View on GitHub

Showing 50 of 196 total issues

Function generate_cms_list has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

pagelist_generator.prototype.generate_cms_list = function () {
    return new Promise(function (resolve, reject) {
        glob(enduro.project_path + '/cms/**/*.js', function (err, files) {
            if (err) { console.log('failed to generate cms list', err) }

Severity: Minor
Found in libs/build_tools/pagelist_generator.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 create_from_theme has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

theme_manager.prototype.create_from_theme = function (theme_name) {
    const self = this

    logger.init('Enduro theme service')

Severity: Major
Found in libs/theme_manager/theme_manager.js - About 4 hrs to fix

    Function browsersync_start has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function browsersync_start (norefresh) {
        logger.timestamp('browsersync started', 'enduro_events')
        browser_sync.init({
            server: {
                baseDir: enduro.project_path + '/' + enduro.config.build_folder,
    Severity: Major
    Found in libs/build_tools/gulp_tasks.js - About 2 hrs to fix

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

      enduro_server.prototype.run = function (server_setup) {
          // stores current enduro_server instance
          const self = this
      
          server_setup = server_setup || {}
      Severity: Major
      Found in libs/enduro_server/enduro_server.js - About 2 hrs to fix

        Function action has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        action.prototype.action = function (dont_do_juice_pull) {
        
            logger.init('Enduro', 'enduro_render_events')
            return Promise.resolve()
                .then(() => {
        Severity: Major
        Found in libs/actions/render.js - About 2 hrs to fix

          File juicebox.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // * ———————————————————————————————————————————————————————— * //
          // *     juicebox
          // *    deals with lack of persistent storage plus adds backup and versioning
          // * ———————————————————————————————————————————————————————— * //
          const juicebox = function () {}
          Severity: Minor
          Found in libs/juicebox/juicebox.js - About 2 hrs to fix

            Function generate_cms_list has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            pagelist_generator.prototype.generate_cms_list = function () {
                return new Promise(function (resolve, reject) {
                    glob(enduro.project_path + '/cms/**/*.js', function (err, files) {
                        if (err) { console.log('failed to generate cms list', err) }
            
            
            Severity: Minor
            Found in libs/build_tools/pagelist_generator.js - About 2 hrs to fix

              Function handler has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  handler: function (cli_arguments) {
                      logger.init('setting up s3')
              
                      return inquirer.prompt([
                          {
              Severity: Minor
              Found in cli_commands/setup_commands/s3.js - About 2 hrs to fix

                Function browsersync_start has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                function browsersync_start (norefresh) {
                    logger.timestamp('browsersync started', 'enduro_events')
                    browser_sync.init({
                        server: {
                            baseDir: enduro.project_path + '/' + enduro.config.build_folder,
                Severity: Minor
                Found in libs/build_tools/gulp_tasks.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 pull has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                juicebox.prototype.pull = function (force) {
                    const self = this
                
                    // if juicebox is not enabled or disabled by flags
                    if (!enduro.config.juicebox_enabled) {
                Severity: Minor
                Found in libs/juicebox/juicebox.js - About 1 hr to fix

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

                  enduro_linker.prototype.read_config = function () {
                      return require(enduro.enduro_path + '/libs/configuration/enduro_configurator').read_config()
                          .then(() => {
                  
                              // stores filesystem
                  Severity: Minor
                  Found in libs/linker/linker.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 handler has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      handler: function (cli_arguments) {
                          logger.init('setting up juicebox')
                  
                          let turning_on = true
                  
                  
                  Severity: Minor
                  Found in cli_commands/setup_commands/juicebox.js - About 1 hr to fix

                    Function init has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    js_handler.prototype.init = function (gulp, browser_sync) {
                    
                        // stores task name
                        const js_handler_task_name = 'js';
                        gulp.task(js_handler_task_name, function() {
                    Severity: Minor
                    Found in libs/build_tools/js_handler.js - About 1 hr to fix

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

                      globalizer_handler.prototype.route_context = function (context, globalizer_string) {
                          return globalizer_string
                              .substring(2)
                              .split('.')
                              .reduce((prev, next) => {
                      Severity: Minor
                      Found in libs/globalizer/globalizer_helpers.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 load has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      flat.prototype.load = function (filename, is_full_absolute_path) {
                          const self = this
                      
                          return new Promise(function (resolve, reject) {
                      
                      
                      Severity: Minor
                      Found in libs/flat_db/flat.js - About 1 hr to fix

                        Function generate_pagelist has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        page_queue_generator.prototype.generate_pagelist = function () {
                        
                            const self = this
                        
                            return new Promise(function (resolve, reject) {
                        Severity: Minor
                        Found in libs/page_rendering/page_queue_generator.js - About 1 hr to fix

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

                          juicebox.prototype.force_pack = function (user) {
                              return new Promise(function (resolve, reject) {
                          
                                  // sets user to developer if juicing is caused by console
                                  user = user || 'developer'
                          Severity: Minor
                          Found in libs/juicebox/juicebox.js - About 1 hr to fix

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

                            admin_security.prototype.add_admin = function (username, password, tags) {
                                const self = this
                            
                                return new Promise(function (resolve, reject) {
                            
                            
                            Severity: Minor
                            Found in libs/admin_utilities/admin_security.js - About 1 hr to fix

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

                              theme_manager.prototype.fetch_theme_info_by_name = function (theme_name, options) {
                                  const self = this
                              
                                  // list all themes and exit if specified theme is not found
                                  if (!theme_name) {
                              Severity: Minor
                              Found in libs/theme_manager/theme_manager.js - About 1 hr to fix

                                Function call has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                api_call.prototype.call = function (req, res, enduro_server) {
                                
                                    let jsonString = ''
                                    req.on('data', function (data) {
                                        jsonString += data
                                Severity: Minor
                                Found in libs/admin_api/save_cms.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language