dataplug-io/dataplug-cli

View on GitHub

Showing 13 of 37 total issues

Function handler has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

declaration.handler = (argv, collection) => {
  const validator = new Ajv({
    useDefaults: true,
    removeAdditional: true,
    allErrors: false
Severity: Major
Found in lib/commands/filter.js - About 3 hrs to fix

    Function handler has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    declaration.handler = (argv, collection) => {
      const validator = new Ajv({
        useDefaults: true,
        allErrors: false
      }).compile(collection.schema)
    Severity: Major
    Found in lib/commands/scan.js - About 3 hrs to fix

      Function handler has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      declaration.handler = (argv, collection) => {
        const progress = !argv.progress ? null : new Progress({
          supplied: (value) => chalk.green('↑') + ` supplied: ${value}`
        })
        if (progress) {
      Severity: Major
      Found in lib/commands/source.js - About 2 hrs to fix

        Function handler has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        declaration.handler = (argv, collection) => {
          const progress = !argv.progress ? null : new Progress({
            flattened: (value) => chalk.yellow('?') + ` flattened: ${value}`
          })
          if (progress) {
        Severity: Major
        Found in lib/commands/flatten.js - About 2 hrs to fix

          Function handler has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          declaration.handler = (argv, collection) => {
            const validator = new Ajv({
              useDefaults: true,
              removeAdditional: true,
              allErrors: false
          Severity: Minor
          Found in lib/commands/filter.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 handler has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          declaration.handler = (argv, collection) => {
            const validator = new Ajv({
              useDefaults: true,
              allErrors: false
            }).compile(collection.schema)
          Severity: Minor
          Found in lib/commands/scan.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 _commandToYargs has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _commandToYargs (declaration) {
              let cli = {}
          
              let prerequisitesMet = true
              if (declaration.prerequisites && this._collections) {
          Severity: Major
          Found in lib/builder.js - About 2 hrs to fix

            Function handler has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            declaration.handler = (argv, collection) => {
              const progress = !argv.progress ? null : new Progress({
                consumed: (value) => chalk.green('↑') + ` consumed: ${value}`
              })
              if (progress) {
            Severity: Major
            Found in lib/commands/target.js - About 2 hrs to fix

              Function validateParameterValue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              function validateParameterValue (parameter, type, format, value) {
                if (type === 'integer') {
                  const parsedValue = Number.parseInt(value)
                  if (_.isNaN(parsedValue)) {
                    throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as integer`)
              Severity: Minor
              Found in lib/configDeclarationToYargs.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 parameterDeclarationToYargs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function parameterDeclarationToYargs (yargs, parameter, declaration) {
                const optionName = _.kebabCase(parameter)
              
                let option = {}
                if (declaration.description) {
              Severity: Minor
              Found in lib/configDeclarationToYargs.js - About 1 hr to fix

                Function builder has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    cli.builder = (yargs) => {
                      yargs = yargs
                          .usage(`Usage: $0 ${declaration.command} <collection> [options]`)
                
                      if (this._collections) {
                Severity: Minor
                Found in lib/builder.js - About 1 hr to fix

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

                    _commandToYargs (declaration) {
                      let cli = {}
                  
                      let prerequisitesMet = true
                      if (declaration.prerequisites && this._collections) {
                  Severity: Minor
                  Found in lib/builder.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 parameterDeclarationToYargs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function parameterDeclarationToYargs (yargs, parameter, declaration) {
                    const optionName = _.kebabCase(parameter)
                  
                    let option = {}
                    if (declaration.description) {
                  Severity: Minor
                  Found in lib/configDeclarationToYargs.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

                  Severity
                  Category
                  Status
                  Source
                  Language