Showing 1,088 of 2,665 total issues
Method Varnish.collectStatistics
has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring. Open
func (v *Varnish) collectStatistics(mx map[string]int64, bs []byte) error {
seenBackends, seenStorages := make(map[string]bool), make(map[string]bool)
sc := bufio.NewScanner(bytes.NewReader(bs))
- 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 object
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
object: function (name, obj, ignore_regex) {
if (typeof ignore_regex !== 'undefined' && ignore_regex.test(name)) {
// console.log('XSS: ignoring "' + name + '"');
return obj;
}
- 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 haproxy.chart.py
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# Description: haproxy netdata python.d module
# Author: ilyam8, ktarasz
# SPDX-License-Identifier: GPL-3.0-or-later
Function easypiechartChartCreate
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.easypiechartChartCreate = function (state, data) {
let chart = $(state.element_chart);
let value = data.result[0];
let min = NETDATA.dataAttribute(state.element, 'easypiechart-min-value', null);
Function easypiechartChartCreate
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.easypiechartChartCreate = function (state, data) {
let chart = $(state.element_chart);
let value = data.result[0];
let min = NETDATA.dataAttribute(state.element, 'easypiechart-min-value', null);
WebLog
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
func (w *WebLog) logPanicStackIfAny() {
err := recover()
if err == nil {
return
}
Parser
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class Parser:
# Since writing a recursive-descendant parser is a straightforward task, we
# do not give many comments here.
DEFAULT_TAGS = {
File utils.js
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
// *** src/dashboard.js/utils.js
NETDATA.name2id = function (s) {
return s
.replace(/ /g, '_')
Function canBeAutoRefreshed
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.canBeAutoRefreshed = function () {
if (!this.enabled) {
if (this.debug) {
this.log('canBeAutoRefreshed() -> not enabled');
}
Function canBeAutoRefreshed
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.canBeAutoRefreshed = function () {
if (!this.enabled) {
if (this.debug) {
this.log('canBeAutoRefreshed() -> not enabled');
}
File charts.py
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# Description:
# Author: Ilya Mashchenko (ilyam8)
# SPDX-License-Identifier: GPL-3.0-or-later
Method Hpssa.updateCharts
has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring. Open
func (h *Hpssa) updateCharts(controllers map[string]*hpssaController) {
seenControllers := make(map[string]bool)
seenArrays := make(map[string]bool)
seenLDrives := make(map[string]bool)
seenPDrives := make(map[string]bool)
- 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 Dnsmasq.collectCacheStatistics
has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring. Open
func (d *Dnsmasq) collectCacheStatistics(mx map[string]int64) error {
/*
;; flags: qr aa rd ra; QUERY: 7, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
- 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 object
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
object: function (name, obj, ignore_regex) {
if (typeof ignore_regex !== 'undefined' && ignore_regex.test(name)) {
// console.log('XSS: ignoring "' + name + '"');
return obj;
}
- 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 NginxPlus.updateCharts
has 118 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (n *NginxPlus) updateCharts() {
const notSeenLimit = 3
for key, v := range n.cache.httpCaches {
if v.updated && !v.hasCharts {
Function chartRefresher
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.chartRefresher = function () {
// console.log('chartRefresher() begin ' + (Date.now() - NETDATA.chartRefresherLastRun).toString() + ' ms since last run');
if (NETDATA.options.page_is_visible === false
&& NETDATA.options.current.stop_updates_when_focus_is_lost
Function chartRefresher
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.chartRefresher = function () {
// console.log('chartRefresher() begin ' + (Date.now() - NETDATA.chartRefresherLastRun).toString() + ' ms since last run');
if (NETDATA.options.page_is_visible === false
&& NETDATA.options.current.stop_updates_when_focus_is_lost
File poolmanager.py
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
# SPDX-License-Identifier: MIT
from __future__ import absolute_import
import collections
import functools
import logging
File gauge.js
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
// gauge.js
NETDATA.gaugeInitialize = function (callback) {
if (typeof netdataNoGauge === 'undefined' || !netdataNoGauge) {
$.ajax({
Function lateInitialization
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
const lateInitialization = () => {
if (typeof this.host !== 'undefined') {
return;
}