elves/elvish

View on GitHub
pkg/cli/term/reader_windows.go

Summary

Maintainability
A
3 hrs
Test Coverage

Function convertEvent has 8 return statements (exceeds 4 allowed).
Open

func convertEvent(event ewindows.InputEvent) Event {
    switch event := event.(type) {
    case *ewindows.KeyEvent:
        if event.BKeyDown == 0 {
            // Ignore keyup events.
Severity: Major
Found in pkg/cli/term/reader_windows.go - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                } else if filteredMod == leftCtrl|rightAlt || filteredMod == leftCtrl|rightAlt|shift {
                    // The combination leftCtrl|rightAlt is used to represent AltGr.
                    // Furthermore, when the actual left Ctrl and right Alt are used
                    // together, the UChar field seems to be always 0; so if we are
                    // here, we can actually be sure that it's AltGr.
    Severity: Major
    Found in pkg/cli/term/reader_windows.go - About 45 mins to fix

      Method reader.ReadEvent has 6 return statements (exceeds 4 allowed).
      Open

      func (r *reader) ReadEvent() (Event, error) {
          r.mutex.Lock()
          defer r.mutex.Unlock()
          handles := []windows.Handle{r.console, r.stopEvent}
          var leadingSurrogate *surrogateKeyEvent
      Severity: Major
      Found in pkg/cli/term/reader_windows.go - About 40 mins to fix

        Function convertEvent has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
        Open

        func convertEvent(event ewindows.InputEvent) Event {
            switch event := event.(type) {
            case *ewindows.KeyEvent:
                if event.BKeyDown == 0 {
                    // Ignore keyup events.
        Severity: Minor
        Found in pkg/cli/term/reader_windows.go - 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 convertRune has 5 return statements (exceeds 4 allowed).
        Open

        func convertRune(keyCode uint16, mod ui.Mod) rune {
            r, ok := keyCodeToRune[keyCode]
            if ok {
                return r
            }
        Severity: Major
        Found in pkg/cli/term/reader_windows.go - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status