dataplug-io/sql-dataplug

View on GitHub

Showing 6 of 12 total issues

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

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

    Function createCollection has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    function createCollection (name) {
      let collection = Object.assign({}, genericCollection)
    
      collection.name = name
      collection.target = dataplug.target(targetConfigDeclaration, (params) => {
    Severity: Minor
    Found in lib/factory.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 createCollection has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function createCollection (name) {
      let collection = Object.assign({}, genericCollection)
    
      collection.name = name
      collection.target = dataplug.target(targetConfigDeclaration, (params) => {
    Severity: Major
    Found in lib/factory.js - About 3 hrs to fix

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

        collection.target = dataplug.target(targetConfigDeclaration, (params) => {
          const options = targetConfigToOptionsMapping.apply(params)
      
          let prologueModifier = null
          if (options.missing) {
      Severity: Major
      Found in lib/factory.js - About 3 hrs to fix

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

        declaration.handler = (argv, collection) => {
          const reader = new JsonStreamReader('!')
          new Promise((resolve, reject) => {
            process.stdin
              .pipe(reader)
        Severity: Minor
        Found in lib/commands/sqlSchema.js - About 1 hr to fix

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

          declaration.handler = (argv, collection) => {
            const progress = !argv.progress ? null : new Progress({
              sqlized: (value) => chalk.yellow('?') + ` sqlized: ${value}`
            })
            if (progress) {
          Severity: Minor
          Found in lib/commands/serialize.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

          Severity
          Category
          Status
          Source
          Language