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
}
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
}
- 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.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())))
- 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 CreateExportUI
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
output io.Writer,
exportOutput io.Writer,
useColors bool,
showProgress bool,
constGC bool,
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":`)...)
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
- 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 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 {
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
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
}
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
}
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 {
- 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"