Gottwik/Enduro

View on GitHub

Showing 196 of 196 total issues

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

flat_helpers.prototype.dir_exists_sync = function (path_to_folder) {
    try {
        return fs.statSync(path_to_folder).isDirectory()
    } 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 25..29

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

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

    return input.toString().toLowerCase()
        .replace(/\s+/g, '_')            // Replace spaces with _ (underline)
        .replace(/[^\w\-_]+/g, '')        // Remove all non-word chars except underline and dashes
        .replace(/\-\-+/g, '-')            // Replace multiple - with single -
        .replace(/__+/g, '-')            // Replace multiple _ with single _
Severity: Major
Found in libs/services/format_service.js and 1 other location - About 1 hr to fix
libs/services/format_service.js on lines 8..13

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

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

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

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

        admin_sessions.get_user_by_session(sid)
            .then((user) => {
    
                if (page_path && globalizer_chain[0] != 'global') {
                    return flat.load(page_path)
    Severity: Major
    Found in libs/admin_api/get_globalized_context.js and 1 other location - About 1 hr to fix
    libs/admin_api/get_globalizer_options.js on lines 54..81

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

    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(sid)
            .then((user) => {
                if (page_path && globalizer_chain[0] != 'global') {
                    return flat.load(page_path)
                } else {
    Severity: Major
    Found in libs/admin_api/get_globalizer_options.js and 1 other location - About 1 hr to fix
    libs/admin_api/get_globalized_context.js on lines 37..48

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

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

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

      logger.prototype.line = function (logtag) {
          if (!pass_tagcheck(logtag)) { return }
          log(chalk('├' + rep(FRAME_WIDTH - 2, '—') + '┤'))
      }
      Severity: Major
      Found in libs/logger.js and 1 other location - About 1 hr to fix
      libs/logger.js on lines 80..83

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

      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

      logger.prototype.end = function (logtag) {
          if (!pass_tagcheck(logtag)) { return }
          log(chalk('└' + rep(FRAME_WIDTH - 2, '—') + '┘'))
      }
      Severity: Major
      Found in libs/logger.js and 1 other location - About 1 hr to fix
      libs/logger.js on lines 74..77

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

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

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

        module.exports = {
            command: ['juice <command>', 'j'],
            desc: 'handles versioning',
            builder: function (yargs) {
                return yargs
        Severity: Major
        Found in cli_commands/juice.js and 1 other location - About 1 hr to fix
        cli_commands/setup.js on lines 1..10

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

        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: ['setup <command>', 's'],
            desc: 'handles versioning',
            builder: function (yargs) {
                return yargs
        Severity: Major
        Found in cli_commands/setup.js and 1 other location - About 1 hr to fix
        cli_commands/juice.js on lines 1..10

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

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

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

                        enduro.config.variables.S3_SECRET = (enduro.config.variables.has_s3_setup && enduro.config.secret.s3.S3_SECRET) || process.env.S3_SECRET
            Severity: Major
            Found in libs/configuration/enduro_configurator.js and 1 other location - About 1 hr to fix
            libs/configuration/enduro_configurator.js on lines 37..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 63.

            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

                        enduro.config.variables.S3_KEY = (enduro.config.variables.has_s3_setup && enduro.config.secret.s3.S3_KEY) || process.env.S3_KEY
            Severity: Major
            Found in libs/configuration/enduro_configurator.js and 1 other location - About 1 hr to fix
            libs/configuration/enduro_configurator.js on lines 38..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 63.

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