Showing 43 of 107 total issues
Function main
has 382 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
material.Load(home("Github/material-design-icons"))
mdi.Load(home("Github/MaterialDesign-Webfont"))
typicons.Load(home("Github/typicons.font"))
fontawesome.Load(home("Github/Font-Awesome"))
Function main
has 236 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
material.Load(home("Github/material-design-icons"))
mdi.Load(home("Github/MaterialDesign-Webfont"))
typicons.Load(home("Github/typicons.font"))
fontawesome.Load(home("Github/Font-Awesome"))
Function main
has a Cognitive Complexity of 57 (exceeds 20 allowed). Consider refactoring. Open
func main() {
material.Load(home("Github/material-design-icons"))
mdi.Load(home("Github/MaterialDesign-Webfont"))
typicons.Load(home("Github/typicons.font"))
fontawesome.Load(home("Github/Font-Awesome"))
- 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 SegmentGroup.Segments
has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring. Open
func (g *SegmentGroup) Segments() []*bar.Segment {
var segments []*bar.Segment
for _, o := range g.outputs {
for _, s := range o.Segments() {
segments = append(segments, s.Clone())
- 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 Watcher.tryWatch
has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring. Open
func (w *Watcher) tryWatch(restarted bool) error {
currentLvl := -1
for lvl, p := range w.hierarchy {
err := w.fswatcher.Add(p)
if err == 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
Function main
has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring. Open
func main() {
material.Load(home("Github/material-design-icons"))
mdi.Load(home("Github/MaterialDesign-Webfont"))
typicons.Load(home("Github/typicons.font"))
fontawesome.Load(home("Github/Font-Awesome"))
- 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
File sample-bar.go
has 594 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Segment
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
func (s *Segment) Text(content string) *Segment {
s.text = content
s.pango = false
return s
}
Function main
has 108 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
colors.LoadFromMap(map[string]string{
"good": "#0f0",
"bad": "#f00",
"degraded": "#ff0",
Function main
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func main() {
colors.LoadFromMap(map[string]string{
"good": "#0f0",
"bad": "#f00",
"degraded": "#ff0",
- 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 parse_args
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def parse_args(signature)
in_fn_ptr = 0
curr = ''
args = []
signature.each_char do |c|
- 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 main
has 28 return statements (exceeds 4 allowed). Open
func main() {
material.Load(home("Github/material-design-icons"))
mdi.Load(home("Github/MaterialDesign-Webfont"))
typicons.Load(home("Github/typicons.font"))
fontawesome.Load(home("Github/Font-Awesome"))
alsaImpl
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
type alsaImpl struct{}
Method write_test_file
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write_test_file(library, package, c_functions)
write_go_file("#{library}_capi_for_test.go") do |out|
out.puts "package #{package}"
out.puts(<<~PREAMBLE)
import "sync"
Method Watcher.tryWatch
has 72 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (w *Watcher) tryWatch(restarted bool) error {
currentLvl := -1
for lvl, p := range w.hierarchy {
err := w.fswatcher.Add(p)
if err == nil {
Function main
has 17 return statements (exceeds 4 allowed). Open
func main() {
material.Load(home("Github/material-design-icons"))
mdi.Load(home("Github/MaterialDesign-Webfont"))
typicons.Load(home("Github/typicons.font"))
fontawesome.Load(home("Github/Font-Awesome"))
Function batteryInfo
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
func batteryInfo(name string) Info {
batteryPath := fmt.Sprintf("/sys/class/power_supply/%s/uevent", name)
l.Fine("Reading from %s", batteryPath)
f, err := fs.Open(batteryPath)
if err != nil {
Function Run
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func Run(modules ...bar.Module) error {
// Oauth configs are setup by modules when they're created.
// Now that all modules are created, the oauth system knows about all providers.
// So if the 'setup-oauth' arg was given, enter interactive setup instead.
// (InteractiveSetup calls os.Exit, so the rest of the bar will not run).
Function fetch
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func fetch(srv *calendar.Service, conf config) ([]Event, error) {
timeMin := timing.Now()
timeMax := timeMin.Add(conf.lookahead)
req := srv.Events.List(conf.calendarID)
Function allBatteriesInfo
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func allBatteriesInfo() Info {
dir, err := fs.Open("/sys/class/power_supply")
if err != nil {
l.Log("No batteries: %s", err)
return Info{Status: Disconnected}