Showing 30 of 58 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
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 = "empty "
acting = "emptying"
- 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 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,
File
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
type File struct {
Mtime time.Time
Parent fs.Item
Name string
Size int64
ParentDir
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
type ParentDir struct {
Path string
}
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
Method ParallelAnalyzer.processDir
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *ParallelAnalyzer) processDir(path string) *Dir {
var (
file *File
err error
totalSize int64
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 = "empty "
acting = "emptying"
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
- 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 UI.showFile
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ui *UI) showFile() *tview.TextView {
if ui.currentDir == nil {
return nil
}
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':
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 {
Method SequentialAnalyzer.processDir
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *SequentialAnalyzer) processDir(path string) *Dir {
var (
file *File
err error
totalSize int64
Method UI.formatFileRow
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ui *UI) formatFileRow(item fs.Item, maxUsage, maxSize int64, marked, ignored bool) string {
var part int
switch {
case ignored:
Method UI.formatFileRow
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (ui *UI) formatFileRow(item fs.Item, maxUsage, maxSize int64, marked, ignored bool) string {
var part int
switch {
case ignored:
- 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 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: ' ',
},
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
}
Function CreateStdoutUI
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
output io.Writer,
useColors bool,
showProgress bool,
showApparentSize bool,
showRelativeSize bool,
Function CreateUI
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
app common.TermApplication,
screen tcell.Screen,
output io.Writer,
useColors bool,
showApparentSize bool,
Method UI.showFile
has 10 return statements (exceeds 4 allowed). Open
func (ui *UI) showFile() *tview.TextView {
if ui.currentDir == nil {
return nil
}