azukiapp/azk

View on GitHub
src/manifest/validate.js

Summary

Maintainability
F
3 days
Test Coverage

Function _validate_wait_option has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static _validate_wait_option(manifest) {
    return _.reduce(manifest.systems, (errors, system) => {

      // ignore if it is not present or equal false
      if (typeof system.options.wait === 'undefined' || system.options.wait === false) {
Severity: Major
Found in src/manifest/validate.js - About 3 hrs to fix

    Function _have_dollar_sign_string_interpotation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static _have_dollar_sign_string_interpotation(manifest) {
        // https://regex101.com/r/eZ4mQ6/3
        var dollar_check = /((?:[$]{|<%|#{-|#{=)[=|-]?)(.*\..*)(}|%>)/;
        return _.reduce(manifest.systems, (errors, system) => {
          var raw = system.options.raw;
    Severity: Minor
    Found in src/manifest/validate.js - About 1 hr to fix

      Avoid too many return statements within this function.
      Open

            return errors;
      Severity: Major
      Found in src/manifest/validate.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return errors.concat(
                    this._entry('fail', 'invalid_option_value', manifest, {
                      option: 'wait.timeout',
                      value: system.options.wait.timeout,
                      system_name: system.name,
        Severity: Major
        Found in src/manifest/validate.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return errors.concat(
                      this._entry('fail', 'invalid_option_type', manifest, {
                        option: 'wait.retry',
                        value: system.options.wait.retry,
                        system_name: system.name,
          Severity: Major
          Found in src/manifest/validate.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                      return errors.concat(
                        this._entry('fail', 'invalid_option_type', manifest, {
                          option: 'wait.timeout',
                          value: system.options.wait.timeout,
                          system_name: system.name,
            Severity: Major
            Found in src/manifest/validate.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return errors.concat(
                        this._deprecate((system.image || {}), manifest, system.name, 'wait', 'wait')
                      );
              Severity: Major
              Found in src/manifest/validate.js - About 30 mins to fix

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

                      if (_.isObject(system.options.wait) && system.options.wait.retry) {
                        if (_.isNumber(system.options.wait.retry) && system.options.wait.retry < 0) {
                          return errors.concat(
                            this._entry('fail', 'invalid_option_value', manifest, {
                              option: 'wait.retry',
                Severity: Major
                Found in src/manifest/validate.js and 1 other location - About 1 day to fix
                src/manifest/validate.js on lines 143..165

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

                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

                      if (_.isObject(system.options.wait) && system.options.wait.timeout) {
                        if (_.isNumber(system.options.wait.timeout) && system.options.wait.timeout < 0) {
                          return errors.concat(
                            this._entry('fail', 'invalid_option_value', manifest, {
                              option: 'wait.timeout',
                Severity: Major
                Found in src/manifest/validate.js and 1 other location - About 1 day to fix
                src/manifest/validate.js on lines 118..140

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

                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

                      if (!_.isNumber(system.options.wait) && !_.isObject(system.options.wait)) {
                        return errors.concat(
                          this._entry('fail', 'invalid_option_type', manifest, {
                            option: 'wait',
                            value: system.options.wait,
                Severity: Major
                Found in src/manifest/validate.js and 1 other location - About 1 hr to fix
                src/manifest/validate.js on lines 94..103

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

                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

                      if (_.isNumber(system.options.wait) && system.options.wait <= 0) {
                        return errors.concat(
                          this._entry('fail', 'invalid_option_value', manifest, {
                            option: 'wait',
                            value: system.options.wait,
                Severity: Major
                Found in src/manifest/validate.js and 1 other location - About 1 hr to fix
                src/manifest/validate.js on lines 106..115

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

                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

                There are no issues that match your filters.

                Category
                Status