vinicioslc/adb-interface-vscode

View on GitHub
src/domain/console/console-interface/console-interface-mock.ts

Summary

Maintainability
A
35 mins
Test Coverage

Function execConsoleSync has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  execConsoleSync(command: string): Buffer {
    let result = Buffer.from('')

    if (this._callback) {
      result = this._callback(command)
Severity: Minor
Found in src/domain/console/console-interface/console-interface-mock.ts - 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

Missing semicolon
Open

    let result = Buffer.from('')

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

        result = this._returnStack[this._returnStack.length - 1]

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

      this._returnStack.push(toReturn)

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t>
Open

  pushToReturnStack(toReturn: Array<Buffer> | Buffer) {

Rule: array-type

Requires using either 'T[]' or 'Array<t>' for arrays.</t>

Notes
  • TypeScript Only
  • Has Fix

Config

One of the following arguments must be provided:

  • "array" enforces use of T[] for all types T.
  • "generic" enforces use of Array<T> for all types T.
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
  "type": "string",
  "enum": [
    "array",
    "generic",
    "array-simple"
  ]
}

For more information see this page.

Missing semicolon
Open

    return output

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

        this._returnStack.push(element)

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

    return this.execConsoleSync(command).toString()

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

  (myArgument: string): Buffer

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

    if (this.interceptor) return this.interceptor(command, result)

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t>
Open

  private _returnStack: Array<Buffer> = []

Rule: array-type

Requires using either 'T[]' or 'Array<t>' for arrays.</t>

Notes
  • TypeScript Only
  • Has Fix

Config

One of the following arguments must be provided:

  • "array" enforces use of T[] for all types T.
  • "generic" enforces use of Array<T> for all types T.
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
  "type": "string",
  "enum": [
    "array",
    "generic",
    "array-simple"
  ]
}

For more information see this page.

== should be ===
Open

        this._returnStack.length == 1 &&

Rule: triple-equals

Requires === and !== in place of == and !=.

Config

Two arguments may be optionally provided:

  • "allow-null-check" allows == and != when comparing to null.
  • "allow-undefined-check" allows == and != when comparing to undefined.
Examples
"triple-equals": true
"triple-equals": true,allow-null-check
"triple-equals": true,allow-undefined-check
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "allow-null-check",
      "allow-undefined-check"
    ]
  },
  "minLength": 0,
  "maxLength": 2
}

For more information see this page.

Missing semicolon
Open

      })

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

      result = this._callback(command)

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

import { IConsoleInterface } from './iconsole-interface'

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

  private _callback: ConsoleCallback

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Interface has only a call signature — use type ConsoleCallback = (myArgument: string) => Buffer instead.
Open

  (myArgument: string): Buffer

Rule: callable-types

An interface or literal type with just a call signature can be written as a function type.

Rationale

style

Notes
  • TypeScript Only
  • Has Fix

Config

Not configurable.

For more information see this page.

Missing semicolon
Open

  private _returnStack: Array<Buffer> = []

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

    this._callback = null

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

    )

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

        result = this._returnStack.shift()

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

    return result

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

  public returnInfinity = true

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

Missing semicolon
Open

    this._callback = callback

Rule: semicolon

Enforces consistent semicolon usage at the end of every statement.

Notes
  • Has Fix

Config

One of the following arguments must be provided:

  • "always" enforces semicolons at the end of every statement.
  • "never" disallows semicolons at the end of every statement except for when they are necessary.

The following arguments may be optionally provided:

  • "ignore-interfaces" skips checking semicolons at the end of interface members.
  • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
  • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
Examples
"semicolon": true,always
"semicolon": true,never
"semicolon": true,always,ignore-interfaces
"semicolon": true,always,ignore-bound-class-methods
Schema
{
  "type": "array",
  "items": [
    {
      "type": "string",
      "enum": [
        "always",
        "never"
      ]
    },
    {
      "type": "string",
      "enum": [
        "ignore-interfaces"
      ]
    }
  ],
  "additionalItems": false
}

For more information see this page.

There are no issues that match your filters.

Category
Status