AdrieanKhisbe/configue

View on GitHub

Showing 8 of 12 total issues

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

const rawHapiPlugin = function(configue, decorateName = 'configue') {
  /**
   * Register the <tt>Configue</tt> plugin and process the various steps and hooks
   * @param server - Hapi server to configure
   * @param options - options of the Configue Plugin
Severity: Minor
Found in src/extensions.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 extendWithFluentBuilder has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function extendWithFluentBuilder(Configue) {
  Configue._options = {};
  optionKeys.forEach(option => {
    Configue[option] = opt => {
      Configue._options[option] = opt;
Severity: Minor
Found in src/core/builder.js - About 1 hr to fix

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

    const loadFiles = (nconf, options) => {
      const files = options.files;
      if (Array.isArray(files) && files.length > 0) {
        for (const file of files) {
          const path = _.getOr(file, 'file', file);
    Severity: Minor
    Found in src/core/workflows.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 resolve has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Configue.prototype.resolve = function() {
      if (this.resolved) return this.async ? Promise.resolve(this) : undefined;
    
      const completeSetup = () => {
        this.resolved = true;
    Severity: Minor
    Found in src/core/configue.js - About 1 hr to fix

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

      const Configue = (module.exports = function Configue(options = {}) {
        if (!(this instanceof Configue)) {
          return new Configue(options);
        }
      
      
      Severity: Minor
      Found in src/core/configue.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 resolve has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      Configue.prototype.resolve = function() {
        if (this.resolved) return this.async ? Promise.resolve(this) : undefined;
      
        const completeSetup = () => {
          this.resolved = true;
      Severity: Minor
      Found in src/core/configue.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 getFirst has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function getFirst(keys, defaultValue, ...rest) {
        const hasDefault = _.isArray(keys) && _.isEmpty(rest);
        for (const key of hasDefault ? keys : [keys, defaultValue, ...rest]) {
          const result = this.nconf.get(formatKey(key));
          if (result !== undefined) return result;
      Severity: Minor
      Found in src/core/getters.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 loadArgv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const loadArgv = (nconf, options) => {
        if (_.has('disable.argv', options)) return promiseIfNeeded(options);
      
        const argOpts = options.argv || {};
        // craft own yargs if needed that is transmit to nconf
      Severity: Minor
      Found in src/core/workflows.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

      Severity
      Category
      Status
      Source
      Language