elves/elvish

View on GitHub
pkg/edit/completion.go

Summary

Maintainability
A
3 hrs
Test Coverage

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])
Severity: Minor
Found in pkg/edit/completion.go - About 1 hr 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 completionStart has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
Open

func completionStart(ed *Editor, bindings tk.Bindings, ev *eval.Evaler, cfg complete.Config, smart bool) {
    codeArea, ok := focusedCodeArea(ed.app)
    if !ok {
        return
    }
Severity: Minor
Found in pkg/edit/completion.go - About 55 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 adaptMatcherMap has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
Open

func adaptMatcherMap(nt notifier, ev *eval.Evaler, m vals.Map) complete.Filterer {
    return func(ctxName, seed string, rawItems []complete.RawItem) []complete.RawItem {
        matcher, ok := lookupFn(m, ctxName)
        if !ok {
            nt.notifyf(
Severity: Minor
Found in pkg/edit/completion.go - About 45 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 completionStart has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func completionStart(ed *Editor, bindings tk.Bindings, ev *eval.Evaler, cfg complete.Config, smart bool) {
Severity: Minor
Found in pkg/edit/completion.go - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status