Gottwik/Enduro

View on GitHub

Showing 196 of 196 total issues

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

      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

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

                            return gulp.src(enduro.project_path + '/assets/css/*.scss')
                                .pipe(bulkSass())
                                .pipe(sourcemaps.init())
                                .pipe(sass())
                                .on('error', function (err) {
                    Severity: Major
                    Found in libs/build_tools/sass_handler.js and 3 other locations - About 1 hr to fix
                    libs/build_tools/js_handler.js on lines 30..40
                    libs/build_tools/less_handler.js on lines 29..40
                    libs/build_tools/stylus_handler.js on lines 27..37

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

                    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 4 locations. Consider refactoring.
                    Open

                            return gulp.src(enduro.project_path + '/assets/css/*.styl')
                                .pipe(sourcemaps.init())
                                .pipe(stylus({
                                    use: [ autoprefixer('last 5 versions') ]
                                }))
                    Severity: Major
                    Found in libs/build_tools/stylus_handler.js and 3 other locations - About 1 hr to fix
                    libs/build_tools/js_handler.js on lines 30..40
                    libs/build_tools/less_handler.js on lines 29..40
                    libs/build_tools/sass_handler.js on lines 28..37

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

                    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

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

                            if (!sid || !filename || !content) {
                                res.send({success: false, message: 'Parameters not provided'})
                                return logger.err('parameters not provided')
                            }
                    Severity: Major
                    Found in libs/admin_api/get_temp_page.js and 1 other location - About 1 hr to fix
                    libs/admin_api/save_cms.js on lines 37..40

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

                    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 4 locations. Consider refactoring.
                    Open

                            return gulp.src(enduro.project_path + '/assets/css/*.less')
                                .pipe(sourcemaps.init())
                                .pipe(less({
                                    paths: enduro.config.less && enduro.config.less.paths || [],
                                    plugins: [ autoprefixer ]
                    Severity: Major
                    Found in libs/build_tools/less_handler.js and 3 other locations - About 1 hr to fix
                    libs/build_tools/js_handler.js on lines 30..40
                    libs/build_tools/sass_handler.js on lines 28..37
                    libs/build_tools/stylus_handler.js on lines 27..37

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

                    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

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

                            if (!sid || !filename || !content) {
                                res.send({success: false, message: 'Parameters not provided'})
                                return logger.err('parameters not provided')
                            }
                    Severity: Major
                    Found in libs/admin_api/save_cms.js and 1 other location - About 1 hr to fix
                    libs/admin_api/get_temp_page.js on lines 40..43

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

                    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 4 locations. Consider refactoring.
                    Open

                                return gulp.src([enduro.project_path + '/assets/js/*.js',
                                                '!' + enduro.project_path + '/assets/js/*.min.js',
                                                '!' + enduro.project_path + '/assets/js/handlebars.js'])
                                    .pipe(sourcemaps.init())
                                    .pipe(gulpif(enduro.config.babel, babel(babelConfig)))
                    Severity: Major
                    Found in libs/build_tools/js_handler.js and 3 other locations - About 1 hr to fix
                    libs/build_tools/less_handler.js on lines 29..40
                    libs/build_tools/sass_handler.js on lines 28..37
                    libs/build_tools/stylus_handler.js on lines 27..37

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

                    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 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 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
                        Severity
                        Category
                        Status
                        Source
                        Language