Showing 32 of 60 total issues

Method UI.showDir has 114 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (ui *UI) showDir() {
    var (
        totalUsage int64
        totalSize  int64
        maxUsage   int64
Severity: Major
Found in tui/show.go - About 3 hrs to fix

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

    func (ui *UI) formatFileRow(item fs.Item, maxUsage, maxSize int64, marked, ignored bool) string {
        part := 0
        if !ignored {
            if ui.ShowApparentSize {
                if size := item.GetSize(); size > 0 {
    Severity: Minor
    Found in tui/format.go - About 2 hrs 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.deleteMarked has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
    Open

    func (ui *UI) deleteMarked(shouldEmpty bool) {
        var action, acting string
        if shouldEmpty {
            action = actionEmpty
            acting = actingEmpty
    Severity: Minor
    Found in tui/marked.go - About 2 hrs 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 CreateUI has 83 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func CreateUI(
        app common.TermApplication,
        screen tcell.Screen,
        output io.Writer,
        useColors bool,
    Severity: Major
    Found in tui/tui.go - About 2 hrs to fix

      Method ParallelAnalyzer.processDir has 80 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (a *ParallelAnalyzer) processDir(path string) *Dir {
          var (
              file       *File
              err        error
              totalSize  int64
      Severity: Major
      Found in pkg/analyze/parallel.go - About 2 hrs to fix

        ParentDir has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

        type ParentDir struct {
            Path string
        }
        Severity: Minor
        Found in pkg/analyze/stored.go - About 2 hrs to fix

          File has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type File struct {
              Mtime  time.Time
              Parent fs.Item
              Name   string
              Size   int64
          Severity: Minor
          Found in pkg/analyze/file.go - About 2 hrs to fix

            Method StoredAnalyzer.processDir has 77 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (a *StoredAnalyzer) processDir(path string) *StoredDir {
                var (
                    file      *File
                    err       error
                    totalSize int64
            Severity: Major
            Found in pkg/analyze/stored.go - About 2 hrs to fix

              Method UI.showFile has 75 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (ui *UI) showFile() *tview.TextView {
                  if ui.currentDir == nil {
                      return nil
                  }
              
              
              Severity: Minor
              Found in tui/show_file.go - About 2 hrs to fix

                Method UI.deleteMarked has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (ui *UI) deleteMarked(shouldEmpty bool) {
                    var action, acting string
                    if shouldEmpty {
                        action = actionEmpty
                        acting = actingEmpty
                Severity: Minor
                Found in tui/marked.go - About 1 hr to fix

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

                  func (ui *UI) showDir() {
                      var (
                          totalUsage int64
                          totalSize  int64
                          maxUsage   int64
                  Severity: Minor
                  Found in tui/show.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

                  Method SequentialAnalyzer.processDir has 66 lines of code (exceeds 50 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 1 hr to fix

                    Method UI.formatFileRow has 64 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (ui *UI) formatFileRow(item fs.Item, maxUsage, maxSize int64, marked, ignored bool) string {
                        part := 0
                        if !ignored {
                            if ui.ShowApparentSize {
                                if size := item.GetSize(); size > 0 {
                    Severity: Minor
                    Found in tui/format.go - About 1 hr to fix

                      Method UI.deleteSelected has 63 lines of code (exceeds 50 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 1 hr to fix

                        Method UI.handleMainActions has 63 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (ui *UI) handleMainActions(key *tcell.EventKey) *tcell.EventKey {
                            switch key.Rune() {
                            case 'd':
                                ui.handleDelete(false)
                            case 'e':
                        Severity: Minor
                        Found in tui/keys.go - About 1 hr to fix

                          Function processDir has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func processDir(items []interface{}) (*analyze.Dir, error) {
                              dir := &analyze.Dir{
                                  File: &analyze.File{
                                      Flag: ' ',
                                  },
                          Severity: Minor
                          Found in report/import.go - About 1 hr to fix

                            Method UI.keyPressed has 14 return statements (exceeds 4 allowed).
                            Open

                            func (ui *UI) keyPressed(key *tcell.EventKey) *tcell.EventKey {
                                if ui.handleCtrlZ(key) == nil {
                                    return nil
                                }
                            
                            
                            Severity: Major
                            Found in tui/keys.go - About 1 hr to fix

                              Function CreateStdoutUI has 9 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  output io.Writer,
                                  useColors bool,
                                  showProgress bool,
                                  showApparentSize bool,
                                  showRelativeSize bool,
                              Severity: Major
                              Found in stdout/stdout.go - About 1 hr to fix

                                Function CreateUI has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    app common.TermApplication,
                                    screen tcell.Screen,
                                    output io.Writer,
                                    useColors bool,
                                    showApparentSize bool,
                                Severity: Major
                                Found in tui/tui.go - About 1 hr to fix

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

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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language