Showing 1,088 of 2,665 total issues
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, user, pw, authurl, *args, **kwargs):
Function makefile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def makefile(self, mode="r", buffering=None, *args, **kwargs):
Function wrap_socket
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def wrap_socket(self, sock, server_side=False,
Function validate_charts
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def validate_charts(self, chart, data, algorithm='absolute', multiplier=1, divisor=1):
Function request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def request(self, method, url, fields=None, headers=None, **urlopen_kw):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
Function _verify_callback
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _verify_callback(cnx, x509, err_no, err_depth, return_code):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, proxy_url, num_pools=10, headers=None,
Function _do_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _do_request(self, url=None, manager=None, retries=1, redirect=True, **kwargs):
Function wrap_socket
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def wrap_socket(self, sock, server_side=False,
Function getSystemdVersion
has 5 return statements (exceeds 4 allowed). Open
Open
func getSystemdVersion() int {
var reVersion = regexp.MustCompile(`[0-9][0-9][0-9]`)
conn, err := dbus.NewWithContext(context.Background())
if err != nil {
Method Job.updateChart
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func (j *Job) updateChart(chart *Chart, collected map[string]int64, sinceLastRun int) bool {
if chart.ignore {
dims := chart.Dims[:0]
for _, dim := range chart.Dims {
if !dim.remove {
- 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 Prometheus.collect
has 5 return statements (exceeds 4 allowed). Open
Open
func (p *Prometheus) collect() (map[string]int64, error) {
mfs, err := p.prom.Scrape()
if err != nil {
return nil, err
}
Method Manager.registerDiscoverers
has 5 return statements (exceeds 4 allowed). Open
Open
func (m *Manager) registerDiscoverers(cfg Config) error {
if len(cfg.File.Read) > 0 || len(cfg.File.Watch) > 0 {
cfg.File.Registry = cfg.Registry
d, err := file.NewDiscovery(cfg.File)
if err != nil {
Method CoreDNS.Init
has 5 return statements (exceeds 4 allowed). Open
Open
func (cd *CoreDNS) Init() error {
if err := cd.validateConfig(); err != nil {
cd.Errorf("config validation: %v", err)
return err
}
Method Discoverer.discoverLocalListeners
has 5 return statements (exceeds 4 allowed). Open
Open
func (d *Discoverer) discoverLocalListeners(ctx context.Context, in chan<- []model.TargetGroup) error {
bs, err := d.ll.discover(ctx)
if err != nil {
if errors.Is(err, context.DeadlineExceeded) {
// there is no point in continuing pointless attempts/use cpu
Method OracleDB.validateDSN
has 5 return statements (exceeds 4 allowed). Open
Open
func (o *OracleDB) validateDSN() (string, error) {
if o.DSN == "" {
return "", errors.New("dsn required but not set")
}
if _, err := goora.ParseConfig(o.DSN); err != nil {
Method SNMP.collect
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *SNMP) collect() (map[string]int64, error) {
if s.sysInfo == nil {
si, err := s.getSysInfo()
if err != nil {
return nil, err
Method Prometheus.Init
has 5 return statements (exceeds 4 allowed). Open
Open
func (p *Prometheus) Init() error {
if err := p.validateConfig(); err != nil {
p.Errorf("validating config: %v", err)
return err
}
Method Dovecot.collectExportGlobal
has 5 return statements (exceeds 4 allowed). Open
Open
func (d *Dovecot) collectExportGlobal(mx map[string]int64, resp []byte) error {
sc := bufio.NewScanner(bytes.NewReader(resp))
if !sc.Scan() {
return errors.New("failed to read fields line from export global response")