evansiroky/db-streamer

View on GitHub

Showing 6 of 10 total issues

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

StreamSqlInserter.prototype.push = function(row) {
  // console.log('push', row)
  if(this.defer) {
    this.dataStream.write(util.makeBufferText(row, this.columns, this.delimiter, this.driver));
  } else {
Severity: Minor
Found in lib/inserters/streamSqlInserter.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 end has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MySqlInserter.prototype.end = function () {
  this.dataStream.end()

  if (this.defer) {
    const self = this
Severity: Minor
Found in lib/inserters/mySqlInserter.js - About 1 hr to fix

    Function getInserter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    streamer.getInserter = function (config) {
      // return a new inserter class
      if (config.useSequelizeBulkInsert) {
        return require('./lib/inserters/sequelizeBulkInserter.js')(config)
      } else if (config.dbConnString) {
    Severity: Minor
    Found in index.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 getQuerier has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    streamer.getQuerier = function (config) {
      if (config.dbConnString) {
        const parsed = parse(config.dbConnString)
        switch (parsed.protocol) {
          case 'postgres:':
    Severity: Minor
    Found in index.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 parseValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    util.parseValue = function(column, v, driver) {
      switch(column) {
        case 'createdAt':
        case 'updatedAt':
          return util.makeDateTime(null, driver);
    Severity: Minor
    Found in lib/util.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 end has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    MySqlInserter.prototype.end = function () {
      this.dataStream.end()
    
      if (this.defer) {
        const self = this
    Severity: Minor
    Found in lib/inserters/mySqlInserter.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