Showing 221 of 222 total issues
Method compoundOp.exec
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (op compoundOp) exec(fm *Frame) ([]any, Exception) {
// Accumulator.
vs, exc := op.subops[0].exec(fm)
if exc != nil {
return nil, exc
- 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 parseSession
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func parseSession(n *Node, fl fileLines) error {
lines := fl.lines
// Process leading empty lines, comment lines and directive lines.
var directives []string
start := 0
- 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
Method redirOp.exec
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (op *redirOp) exec(fm *Frame) Exception {
var dst int
if op.dstOp == nil {
// No explicit FD destination specified; use default destinations
switch op.mode {
- 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
Method formOp.exec
has 13 return statements (exceeds 4 allowed). Open
func (op *formOp) exec(fm *Frame) (errRet Exception) {
// fm here is always a sub-frame created in compiler.pipeline, so it can
// be safely modified.
// Temporary assignment.
Function readEvent
has 13 return statements (exceeds 4 allowed). Open
func readEvent(rd byteReaderWithTimeout) (event Event, err error) {
var r rune
r, err = readRune(rd, -1)
if err != nil {
return
Function adaptArgGeneratorMap
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func adaptArgGeneratorMap(ev *eval.Evaler, m vals.Map) complete.ArgGenerator {
return func(args []string) ([]complete.RawItem, error) {
gen, ok := lookupFn(m, args[0])
if !ok {
return nil, fmt.Errorf("arg completer for %s not a function", args[0])
- 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 completeGetopt
has 13 return statements (exceeds 4 allowed). Open
func completeGetopt(fm *eval.Frame, vArgs, vOpts, vArgHandlers any) error {
args, err := parseGetoptArgs(vArgs)
if err != nil {
return err
}
Method goFn.Call
has 12 return statements (exceeds 4 allowed). Open
func (b *goFn) Call(f *Frame, args []any, opts map[string]any) error {
if b.variadicArg != nil {
if len(args) < len(b.normalArgs) {
return errs.ArityMismatch{What: "arguments",
ValidLow: len(b.normalArgs), ValidHigh: -1, Actual: len(args)}
Method globPattern.Index
has 11 return statements (exceeds 4 allowed). Open
func (gp globPattern) Index(k any) (any, error) {
modifierv, ok := k.(string)
if !ok {
return nil, ErrModifierMustBeString
}
Function ParseKey
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func ParseKey(s string) (Key, error) {
var k Key
// Parse modifiers.
for {
- 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 compileList
has 11 return statements (exceeds 4 allowed). Open
func compileList(elems []*parse.Compound) (Filter, error) {
if len(elems) == 0 {
return nil, errEmptySubfilter
}
head, ok := cmpd.StringLiteral(elems[0])
Function genScriptHTML
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function genScriptHTML(os, arch, version, dir, sudo, mirror) {
const host = mirror === 'tuna' ? 'mirrors.tuna.tsinghua.edu.cn/elvish' : 'dl.elv.sh';
const urlBase = `https://${host}/${os}-${arch}/elvish-${version}`;
if (os === 'windows') {
const url = link(urlBase + '.zip');
- 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 main
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function main() {
// Set up change detection.
for (const e of document.querySelectorAll('input')) {
e.addEventListener('input', (event) => {
const el = event.target;
- 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 onChange
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function onChange(name, value) {
trySetLocalStorage(name, value);
// Update input controls.
if (name === 'os') {
- 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 glob
has 10 return statements (exceeds 4 allowed). Open
func glob(segs []Segment, dir string, cb func(PathInfo) bool) bool {
// Consume non-wildcard path elements simply by following the path. This may
// seem like an optimization, but is actually required for "." and ".." to
// be used as path elements, as they do not appear in the result of ReadDir.
// It is also required for handling directory components that are actually
Method forOp.exec
has 10 return statements (exceeds 4 allowed). Open
func (op *forOp) exec(fm *Frame) Exception {
variable, err := derefLValue(fm, op.lvalue)
if err != nil {
return fm.errorp(op.lvalue, err)
}
Function createNode
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
func createNode(shift uint32, k1 any, v1 any, h2 uint32, k2 any, v2 any, h Hash, eq Equal) node {
Function replace
has 10 return statements (exceeds 4 allowed). Open
func replace(fm *eval.Frame, opts replaceOpts, argPattern string, argRepl any, source string) (string, error) {
pattern, err := makePattern(argPattern, opts.Posix, opts.Longest)
if err != nil {
return "", err
Consider simplifying this complex logical expression. Open
if p.canOpen && p.typ == closer.typ &&
((!p.canClose && !closer.canOpen) ||
(p.n+closer.n)%3 != 0 || (p.n%3 == 0 && closer.n%3 == 0)) {
Method buffer.ops
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
func (b *buffer) ops() []InlineOp {
var ops []InlineOp
for _, p := range b.pieces {
p.iterate(func(op InlineOp) {
if op.Type == OpText {
- 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"