Gottwik/Enduro

View on GitHub

Showing 50 of 196 total issues

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/get_temp_page.js - About 1 hr to fix

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

                function build (pagepath, partial_pages, fullpath) {
    
                    // decides if pagepath is folder or file
                    if (pagepath.length == 1) {
    
    
    Severity: Minor
    Found in libs/build_tools/pagelist_generator.js - About 1 hr to fix

      Function culturize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      function culturize (context, culture) {
          if (typeof (context) != 'object') {
              return context
          }
      
      
      Severity: Minor
      Found in libs/babel/babel.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 request_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      remote_handler.prototype.request_file = function (url) {
          return new Promise(function (resolve, reject) {
              if (flat_helpers.is_local(url)) {
                  fs.readFile(url, 'utf8', function (err, data) {
                      if (err) {
      Severity: Minor
      Found in libs/remote_tools/remote_handler.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 call has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      api_call.prototype.call = function (req, res, enduro_server) {
      
          // gets query parameters
          const sid = req.query.sid
          const globalizer_string = req.query.globalizer_string
      Severity: Minor
      Found in libs/admin_api/get_globalizer_options.js - About 1 hr to fix

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

        function abstract_diff_item (item) {
        
            item.filename = item.name1 || item.name2
            item.name = item.filename
            item.type = item.type1 || item.type2
        Severity: Minor
        Found in libs/juicebox/juice_diff.js - About 1 hr to fix

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

          api_call.prototype.call = function (req, res, enduro_server) {
          
              const sid = req.query.sid
          
              enduro.flags.temporary_nostaticwatch = true
          Severity: Minor
          Found in libs/admin_api/juice_push.js - About 1 hr to fix

            Function get_user_by_username has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            admin_security.prototype.get_user_by_username = function (username) {
                return new Promise(function (resolve, reject) {
                    // load up all admins
                    return flat.load(enduro.config.admin_secure_file)
                        .then((raw_userlist) => {
            Severity: Minor
            Found in libs/admin_utilities/admin_security.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 upload_by_url has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            file_uploader.prototype.upload_by_url = function (file_url) {
                const self = this
                return new Promise(function (resolve, reject) {
            
                    const filename = flat_helpers.get_filename_from_url(file_url)
            Severity: Minor
            Found in libs/admin_utilities/file_uploader.js - About 1 hr to fix

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

              filesystem.prototype.upload = function (filename, path_to_file) {
                  const self = this
              
                  return new Promise(function (resolve, reject) {
              
              
              Severity: Minor
              Found in libs/remote_tools/filesystems/s3_filesystem.js - About 1 hr to fix

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

                page_renderer.prototype.render_file_by_context = function (template_path, context, culture) {
                
                    // extracts the relative path to the template from the absolute path
                    const file_regex_match = template_path.match(/pages(?:\/|\\)(.*)\.([^\\/]+)$/)
                    const filename = file_regex_match[1]
                Severity: Minor
                Found in libs/page_rendering/page_renderer.js - About 1 hr to fix

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

                  api_call.prototype.call = function (req, res, enduro_server) {
                  
                      // gets query parameters
                      const sid = req.query.sid
                      const filename = req.query.filename
                  Severity: Minor
                  Found in libs/admin_api/get_cms.js - About 1 hr to fix

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

                    juice_diff.prototype.diff = function (path1, path2) {
                    
                        let store_compare_result
                        return dircompare.compare(path1, path2)
                            .then((compare_result) => {
                    Severity: Minor
                    Found in libs/juicebox/juice_diff.js - About 1 hr to fix

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

                      global_data.prototype.get_global_data = function () {
                      
                          // Constants
                          const data_path = [enduro.project_path + '/cms/global/**/*.js', enduro.project_path + '/cms/.settings.js']
                      
                      
                      Severity: Minor
                      Found in libs/global_data.js - About 1 hr to fix

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

                        trollhunter.prototype.verify_passphrase = function (passphrase) {
                            return new Promise(function (resolve, reject) {
                        
                                if (!passphrase) {
                                    return reject('no passphrase provided')
                        Severity: Minor
                        Found in libs/trollhunter.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

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

                        function traverse_offline (context, list_of_external_resources_to_download) {
                            for (c in context) {
                        
                                if (typeof context[c] === 'string') {
                                    links = parse_for_external_links(context[c])
                        Severity: Minor
                        Found in libs/remote_tools/offline_handler.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

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

                        helper.prototype.register = function () {
                        
                            enduro.templating_engine.registerHelper('grouped_each', function (every, context, options) {
                        
                                if (!context || !(Object.keys(context).length || context.length)) {
                        Severity: Minor
                        Found in hbs_helpers/grouped_each.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

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

                        ab_tester.prototype.get_ab_list = function () {
                            return page_queue_generator.get_all_pages()
                                .then((pages) => {
                        
                                    // gets page list
                        Severity: Minor
                        Found in libs/ab_testing/ab_tester.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

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

                        helper.prototype.register = function () {
                        
                            enduro.templating_engine.registerHelper('times', function (iterations, upperrange, block) {
                        
                                // will store the final accumulated html
                        Severity: Minor
                        Found in hbs_helpers/times.js - About 45 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

                        Function read_helpers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        helper_handler.prototype.read_helpers = function () {
                            return new Promise(function (resolve, reject) {
                                glob([flat_helpers_PATH, PROJECT_HELPERS_PATH], function (err, files) {
                                    if (err) { return console.log(err) }
                                    async.each(files, function (file, callback) {
                        Severity: Minor
                        Found in libs/helper_handler.js - About 35 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

                        Severity
                        Category
                        Status
                        Source
                        Language