src/config.js

Summary

Maintainability
F
1 wk
Test Coverage

File config.js has 1011 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const _ = require('underscore-plus');
const { Emitter } = require('event-kit');
const {
  getValueAtKeyPath,
  setValueAtKeyPath,
Severity: Major
Found in src/config.js - About 2 days to fix

    Config has 50 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Config {
      static addSchemaEnforcer(typeName, enforcerFunction) {
        if (schemaEnforcers[typeName] == null) {
          schemaEnforcers[typeName] = [];
        }
    Severity: Minor
    Found in src/config.js - About 7 hrs to fix

      Function unset has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

        unset(keyPath, options) {
          if (!this.settingsLoaded) {
            this.pendingOperations.push(() => this.unset(keyPath, options));
          }
      
      
      Severity: Minor
      Found in src/config.js - About 3 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 unset has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        unset(keyPath, options) {
          if (!this.settingsLoaded) {
            this.pendingOperations.push(() => this.unset(keyPath, options));
          }
      
      
      Severity: Major
      Found in src/config.js - About 2 hrs to fix

        Function getSchema has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          getSchema(keyPath) {
            const keys = splitKeyPath(keyPath);
            let { schema } = this;
            for (let key of keys) {
              let childSchema;
        Severity: Minor
        Found in src/config.js - About 2 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 coerce has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            coerce(keyPath, value, schema) {
              if (!isPlainObject(value)) {
                throw new Error(
                  `Validation failed at ${keyPath}, ${JSON.stringify(
                    value
        Severity: Minor
        Found in src/config.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 coerce has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            coerce(keyPath, value, schema) {
              if (!isPlainObject(value)) {
                throw new Error(
                  `Validation failed at ${keyPath}, ${JSON.stringify(
                    value
        Severity: Minor
        Found in src/config.js - About 1 hr to fix

          Function setScopedDefaultsFromSchema has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            setScopedDefaultsFromSchema(keyPath, schema) {
              if (schema.scopes != null && isPlainObject(schema.scopes)) {
                const scopedDefaults = {};
                for (let scope in schema.scopes) {
                  const scopeSchema = schema.scopes[scope];
          Severity: Minor
          Found in src/config.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 getRawValue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            getRawValue(keyPath, options = {}) {
              let value;
              if (
                !options.excludeSources ||
                !options.excludeSources.includes(this.mainSource)
          Severity: Minor
          Found in src/config.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 set has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            set(...args) {
              let [keyPath, value, options = {}] = args;
          
              if (!this.settingsLoaded) {
                this.pendingOperations.push(() => this.set(keyPath, value, options));
          Severity: Minor
          Found in src/config.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 makeValueConformToSchema has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            makeValueConformToSchema(keyPath, value, options) {
              if (options != null ? options.suppressException : undefined) {
                try {
                  return this.makeValueConformToSchema(keyPath, value);
                } catch (e) {
          Severity: Minor
          Found in src/config.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 withoutEmptyObjects has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          const withoutEmptyObjects = object => {
            let resultObject;
            if (isPlainObject(object)) {
              for (let key in object) {
                const value = object[key];
          Severity: Minor
          Found in src/config.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 getAll has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            getAll(keyPath, options) {
              let globalValue, result, scope;
              if (options != null) {
                ({ scope } = options);
              }
          Severity: Minor
          Found in src/config.js - About 1 hr to fix

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

              setSchema(keyPath, schema) {
                if (!isPlainObject(schema)) {
                  throw new Error(
                    `Error loading schema for ${keyPath}: schemas can only be objects!`
                  );
            Severity: Minor
            Found in src/config.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 deepDefaults has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              deepDefaults(target) {
                let result = target;
                let i = 0;
                while (++i < arguments.length) {
                  const object = arguments[i];
            Severity: Minor
            Found in src/config.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 setSchema has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              setSchema(keyPath, schema) {
                if (!isPlainObject(schema)) {
                  throw new Error(
                    `Error loading schema for ${keyPath}: schemas can only be objects!`
                  );
            Severity: Minor
            Found in src/config.js - About 1 hr to fix

              Function set has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                set(...args) {
                  let [keyPath, value, options = {}] = args;
              
                  if (!this.settingsLoaded) {
                    this.pendingOperations.push(() => this.set(keyPath, value, options));
              Severity: Minor
              Found in src/config.js - About 1 hr to fix

                Function setScopedDefaultsFromSchema has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  setScopedDefaultsFromSchema(keyPath, schema) {
                    if (schema.scopes != null && isPlainObject(schema.scopes)) {
                      const scopedDefaults = {};
                      for (let scope in schema.scopes) {
                        const scopeSchema = schema.scopes[scope];
                Severity: Minor
                Found in src/config.js - About 1 hr to fix

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

                    setRawValue(keyPath, value, options = {}) {
                      const source = options.source ? options.source : undefined;
                      const settingsToChange =
                        source === this.projectFile ? 'projectSettings' : 'settings';
                      const defaultValue = getValueAtKeyPath(this.defaultSettings, keyPath);
                  Severity: Minor
                  Found in src/config.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 validateEnum has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      validateEnum(keyPath, value, schema) {
                        let possibleValues = schema.enum;
                  
                        if (Array.isArray(possibleValues)) {
                          possibleValues = possibleValues.map(value => {
                  Severity: Minor
                  Found in src/config.js - About 1 hr to fix

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

                      setDefaults(keyPath, defaults) {
                        if (defaults != null && isPlainObject(defaults)) {
                          const keys = splitKeyPath(keyPath);
                          this.transact(() => {
                            const result = [];
                    Severity: Minor
                    Found in src/config.js - About 1 hr to fix

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

                        _resetSettings(newSettings, options = {}) {
                          const source = options.source;
                          newSettings = Object.assign({}, newSettings);
                          if (newSettings.global != null) {
                            newSettings['*'] = newSettings.global;
                      Severity: Minor
                      Found in src/config.js - About 1 hr to fix

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

                          get(...args) {
                            let keyPath, options, scope;
                            if (args.length > 1) {
                              if (typeof args[0] === 'string' || args[0] == null) {
                                [keyPath, options] = args;
                        Severity: Minor
                        Found in src/config.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 coerce has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            coerce(keyPath, value, schema) {
                              if (!Array.isArray(value)) {
                                throw new Error(
                                  `Validation failed at ${keyPath}, ${JSON.stringify(
                                    value
                        Severity: Minor
                        Found in src/config.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 observe has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          observe(...args) {
                            let callback, keyPath, options, scopeDescriptor;
                            if (args.length === 2) {
                              [keyPath, callback] = args;
                            } else if (
                        Severity: Minor
                        Found in src/config.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 executeSchemaEnforcers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          static executeSchemaEnforcers(keyPath, value, schema) {
                            let error = null;
                            let types = schema.type;
                            if (!Array.isArray(types)) {
                              types = [types];
                        Severity: Minor
                        Found in src/config.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

                        Function validateEnum has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            validateEnum(keyPath, value, schema) {
                              let possibleValues = schema.enum;
                        
                              if (Array.isArray(possibleValues)) {
                                possibleValues = possibleValues.map(value => {
                        Severity: Minor
                        Found in src/config.js - About 25 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 extractDefaultsFromSchema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          extractDefaultsFromSchema(schema) {
                            if (schema.default != null) {
                              return schema.default;
                            } else if (
                              schema.type === 'object' &&
                        Severity: Minor
                        Found in src/config.js - About 25 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 getAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          getAll(keyPath, options) {
                            let globalValue, result, scope;
                            if (options != null) {
                              ({ scope } = options);
                            }
                        Severity: Minor
                        Found in src/config.js - About 25 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

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

                          integer: {
                            coerce(keyPath, value, schema) {
                              value = parseInt(value);
                              if (isNaN(value) || !isFinite(value)) {
                                throw new Error(
                        Severity: Major
                        Found in src/config.js and 1 other location - About 2 hrs to fix
                        src/config.js on lines 1455..1467

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

                        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

                          number: {
                            coerce(keyPath, value, schema) {
                              value = parseFloat(value);
                              if (isNaN(value) || !isFinite(value)) {
                                throw new Error(
                        Severity: Major
                        Found in src/config.js and 1 other location - About 2 hrs to fix
                        src/config.js on lines 1441..1453

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

                        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

                          unshiftAtKeyPath(keyPath, value) {
                            const left = this.get(keyPath);
                            const arrayValue = left == null ? [] : left;
                            const result = arrayValue.unshift(value);
                            this.set(keyPath, arrayValue);
                        Severity: Major
                        Found in src/config.js and 1 other location - About 1 hr to fix
                        src/config.js on lines 946..952

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

                        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

                          pushAtKeyPath(keyPath, value) {
                            const left = this.get(keyPath);
                            const arrayValue = left == null ? [] : left;
                            const result = arrayValue.push(value);
                            this.set(keyPath, arrayValue);
                        Severity: Major
                        Found in src/config.js and 1 other location - About 1 hr to fix
                        src/config.js on lines 954..960

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

                        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 (schema.minimum != null && typeof schema.minimum === 'number') {
                                value = Math.max(value, schema.minimum);
                              }
                        Severity: Minor
                        Found in src/config.js and 1 other location - About 40 mins to fix
                        src/config.js on lines 1635..1637

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

                        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 (schema.maximum != null && typeof schema.maximum === 'number') {
                                value = Math.min(value, schema.maximum);
                              }
                        Severity: Minor
                        Found in src/config.js and 1 other location - About 40 mins to fix
                        src/config.js on lines 1632..1634

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

                        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