senecajs/seneca-repl

View on GitHub
bin/seneca-repl-exec.js

Summary

Maintainability
C
7 hrs
Test Coverage

File seneca-repl-exec.js has 537 lines of code (exceeds 250 allowed). Consider refactoring.
Invalid

#!/usr/bin/env node

/* Copyright (c) 2019-2024 voxgig and other contributors, MIT License */
'use strict'

Severity: Major
Found in bin/seneca-repl-exec.js - About 1 day to fix

    Function operate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Invalid

    function operate(spec, done) {
      state.connection.first = true
      state.connection.quit = false
    
      // state.connection.sock = Net.connect(spec.port, spec.host)
    Severity: Minor
    Found in bin/seneca-repl-exec.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 expr has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    function expr(spec, exprState) {
      exprState = exprState || { i: 0, val: undefined }
      let top = false
    
      if (null == exprState.tokens) {
    Severity: Minor
    Found in bin/seneca-repl-exec.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

    Avoid deeply nested control flow statements.
    Open

                  if (31 < cc || 8 === cc) {
                    if (127 === cc || 8 === cc) {
                      // state.connection.search =
                      //  state.connection.search.substring(0,state.connection.search.length-1)
                      // state.connection.offset = 0
    Severity: Major
    Found in bin/seneca-repl-exec.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      for (let i = 0; i < history.length; i++) {
                        if (history[i].includes(search)) {
                          if (0 === offset) {
                            state.connection.readline.write(
                              makesearchprompt(search) + history[i],
      Severity: Major
      Found in bin/seneca-repl-exec.js - About 45 mins to fix

        Avoid too many return statements within this function.
        Open

                return re
        Severity: Major
        Found in bin/seneca-repl-exec.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return expr(exprState)
          Severity: Major
          Found in bin/seneca-repl-exec.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return expr(exprState)
            Severity: Major
            Found in bin/seneca-repl-exec.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return exprState.val
              Severity: Major
              Found in bin/seneca-repl-exec.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return JP(head)
                Severity: Major
                Found in bin/seneca-repl-exec.js - About 30 mins to fix

                  Function connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function connect(spec) {
                    let duplex = null
                    let protocol = spec.url.protocol
                  
                    if ('telnet:' === protocol) {
                  Severity: Minor
                  Found in bin/seneca-repl-exec.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

                  There are no issues that match your filters.

                  Category
                  Status