Gottwik/Enduro

View on GitHub

Showing 196 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

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

    helper.prototype.register = function () {
        enduro.templating_engine.registerHelper('add', function () {
    
            if (arguments.length <= 1) {
                return ''
    Severity: Major
    Found in hbs_helpers/add.js and 1 other location - About 3 hrs to fix
    hbs_helpers/multiply.js on lines 12..24

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

    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

    helper.prototype.register = function () {
    
        enduro.templating_engine.registerHelper('multiply', function () {
    
            if (arguments.length <= 1) {
    Severity: Major
    Found in hbs_helpers/multiply.js and 1 other location - About 3 hrs to fix
    hbs_helpers/add.js on lines 16..27

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

    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

    module.exports = {
        command: 'add <cultures..>',
        desc: 'adds one or more culture',
        builder: (yargs) => {
            return yargs
    Severity: Major
    Found in cli_commands/culture_commands/add.js and 1 other location - About 3 hrs to fix
    cli_commands/secure.js on lines 1..18

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

    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

    module.exports = {
        command: 'secure <passphrase>',
        desc: 'secures website against random visits',
        builder: (yargs) => {
            return yargs
    Severity: Major
    Found in cli_commands/secure.js and 1 other location - About 3 hrs to fix
    cli_commands/culture_commands/add.js on lines 1..18

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

    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

    module.exports = {
        command: ['log', 'l'],
        desc: 'shows edit history',
        builder: (yargs) => {
            return yargs
    Severity: Major
    Found in cli_commands/juice_commands/log.js and 1 other location - About 3 hrs to fix
    cli_commands/juice_commands/make_new.js on lines 4..22

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

    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

    module.exports = {
        command: ['make_new', 'm'],
        desc: 'timestamps all cms files with current time',
        builder: (yargs) => {
            return yargs
    Severity: Major
    Found in cli_commands/juice_commands/make_new.js and 1 other location - About 3 hrs to fix
    cli_commands/juice_commands/log.js on lines 1..19

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

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

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

        juice_helpers.prototype.print_out_diff_folder_with_cms = function (folder) {
            const local_path = path.join(enduro.project_path, 'cms')
            const juice_path = path.join(enduro.project_path, folder)
        
            return juice_diff.print_out_diff(local_path, juice_path)
        Severity: Major
        Found in libs/juicebox/juice_helpers.js and 1 other location - About 2 hrs to fix
        libs/juicebox/juice_helpers.js on lines 33..38

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

        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

        juice_helpers.prototype.get_diff_folder_with_cms = function (folder) {
            const local_path = path.join(enduro.project_path, 'cms')
            const juice_path = path.join(enduro.project_path, folder)
        
            return juice_diff.diff(local_path, juice_path)
        Severity: Major
        Found in libs/juicebox/juice_helpers.js and 1 other location - About 2 hrs to fix
        libs/juicebox/juice_helpers.js on lines 23..28

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

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

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

                admin_sessions.get_user_by_session(req.query.sid)
                    .then((user) => {
                        logger.timestamp(user + 'is trying to create a new page', 'page_manipulation')
                        return page_adding_service.new_generator_page(new_pagename, generator)
                    }, (user) => {
            Severity: Major
            Found in libs/admin_api/add_page.js and 1 other location - About 2 hrs to fix
            libs/admin_api/delete_page.js on lines 23..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 77.

            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

                admin_sessions.get_user_by_session(req.query.sid)
                    .then((user) => {
                        logger.timestamp(user + 'is trying to delete page ' + pagename, 'page_manipulation')
                        return page_adding_service.delete_page(pagename)
                    }, (user) => {
            Severity: Major
            Found in libs/admin_api/delete_page.js and 1 other location - About 2 hrs to fix
            libs/admin_api/add_page.js on lines 24..38

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

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

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

                flat_helpers.prototype.file_exists_sync = function (file_path) {
                    try {
                        return fs.statSync(file_path).isFile()
                    } catch (err) { return false }
                }
                Severity: Major
                Found in libs/flat_db/flat_helpers.js and 1 other location - About 1 hr to fix
                libs/flat_db/flat_helpers.js on lines 61..65

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

                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