Showing 31 of 59 total issues

Method UI.showFile has 10 return statements (exceeds 4 allowed).
Open

func (ui *UI) showFile() *tview.TextView {
    if ui.currentDir == nil {
        return nil
    }

Severity: Major
Found in tui/actions.go - About 1 hr to fix

    Method UI.showFile has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
    Open

    func (ui *UI) showFile() *tview.TextView {
        if ui.currentDir == nil {
            return nil
        }
    
    
    Severity: Minor
    Found in tui/actions.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

    Method UI.sortItems has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
    Open

    func (ui *UI) sortItems() {
        if ui.sortBy == sizeSortKey {
            if ui.ShowApparentSize {
                if ui.sortOrder == descOrder {
                    sort.Sort(sort.Reverse(fs.ByApparentSize(ui.currentDir.GetFiles())))
    Severity: Minor
    Found in tui/sort.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 CreateExportUI has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        output io.Writer,
        exportOutput io.Writer,
        useColors bool,
        showProgress bool,
        constGC bool,
    Severity: Minor
    Found in report/export.go - About 45 mins to fix

      Method Dir.EncodeJSON has 7 return statements (exceeds 4 allowed).
      Open

      func (f *Dir) EncodeJSON(writer io.Writer, topLevel bool) error {
          buff := make([]byte, 0, 20)
      
          buff = append(buff, []byte(`[{"name":`)...)
      
      
      Severity: Major
      Found in pkg/analyze/encode.go - About 45 mins to fix

        Method SequentialAnalyzer.processDir has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
        Open

        func (a *SequentialAnalyzer) processDir(path string) *Dir {
            var (
                file      *File
                err       error
                totalSize int64
        Severity: Minor
        Found in pkg/analyze/sequential.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 ReadAnalysis has 6 return statements (exceeds 4 allowed).
        Open

        func ReadAnalysis(input io.Reader) (*analyze.Dir, error) {
            var data interface{}
        
            var buff bytes.Buffer
            if _, err := buff.ReadFrom(input); err != nil {
        Severity: Major
        Found in report/import.go - About 40 mins to fix

          Method UI.exportDir has 5 return statements (exceeds 4 allowed).
          Open

          func (ui *UI) exportDir(dir fs.Item, waitWritten *sync.WaitGroup) error {
              sort.Sort(sort.Reverse(dir.GetFiles()))
          
              var (
                  buff bytes.Buffer
          Severity: Major
          Found in report/export.go - About 35 mins to fix

            Method UI.onMouse has 5 return statements (exceeds 4 allowed).
            Open

            func (ui *UI) onMouse(event *tcell.EventMouse, action tview.MouseAction) (*tcell.EventMouse, tview.MouseAction) {
                if event == nil {
                    return nil, action
                }
            
            
            Severity: Major
            Found in tui/mouse.go - About 35 mins to fix

              Method LinuxDevicesInfoGetter.GetMounts has 5 return statements (exceeds 4 allowed).
              Open

              func (t LinuxDevicesInfoGetter) GetMounts() (Devices, error) {
                  file, err := os.Open(t.MountsPath)
                  if err != nil {
                      return nil, err
                  }
              Severity: Major
              Found in pkg/device/dev_linux.go - About 35 mins to fix

                Method UI.deleteSelected has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                Open

                func (ui *UI) deleteSelected(shouldEmpty bool) {
                    row, column := ui.table.GetSelection()
                    selectedItem := ui.table.GetCell(row, column).GetReference().(fs.Item)
                
                    if ui.deleteInBackground {
                Severity: Minor
                Found in tui/actions.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

                Severity
                Category
                Status
                Source
                Language