ebemunk/node-uci

View on GitHub

Showing 5 of 21 total issues

Function goCommand has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function goCommand(options) {
  let cmd = 'go'
  const commands = [
    'searchmoves', //[moves]
    'ponder', //bool
Severity: Minor
Found in src/parseUtil/goCommand.js - About 1 hr to fix

    Function getBufferUntil has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async getBufferUntil(condition) {
        const lines = []
        let listener
        let reject_ref
        const p = new Promise((resolve, reject) => {
    Severity: Minor
    Found in src/Engine/index.js - About 1 hr to fix

      Function parseOption has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function parseOption(line) {
        const parsed = REGEX.option.exec(line)
        if (!parsed) return null
      
        const option = {
      Severity: Minor
      Found in src/parseUtil/parseOption.js - About 1 hr to fix

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

          goInfinite(options = {}) {
            if (!this.proc)
              throw new Error('cannot call "goInfinite()": engine process not running')
            //set up emitter
            this.emitter = new EventEmitter()
        Severity: Minor
        Found in src/Engine/index.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 goReducer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function goReducer(result, line) {
          const cmdType = get(REGEX.cmdType.exec(line), 1)
          switch (cmdType) {
            case 'bestmove': {
              const best = parseBestmove(line)
        Severity: Minor
        Found in src/parseUtil/goReducer.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

        Severity
        Category
        Status
        Source
        Language