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'
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)
- Read upRead up
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) {
- Read upRead up
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
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],
Avoid too many return
statements within this function. Open
return re
Avoid too many return
statements within this function. Open
return expr(exprState)
Avoid too many return
statements within this function. Open
return expr(exprState)
Avoid too many return
statements within this function. Open
return exprState.val
Avoid too many return
statements within this function. Open
return JP(head)
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) {
- Read upRead up
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"