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
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 {
- 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.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
- 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,
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
ParentDir
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
type ParentDir struct {
Path string
}
File
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
type File struct {
Mtime time.Time
Parent fs.Item
Name string
Size int64
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 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
}
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
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 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
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 {
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 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':
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 a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (ui *UI) showFile() *tview.TextView {
if ui.currentDir == nil {
return nil
}
- 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"