Showing 1,088 of 2,665 total issues
Method Sensors.updateCharts
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *Sensors) updateCharts(chips []*lmsensors.Chip) {
seen := make(map[string]bool)
for _, chip := range chips {
for _, sn := range chip.Sensors.Voltage {
Method Manager.dyncfgConfigUpdate
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *Manager) dyncfgConfigUpdate(fn functions.Function) {
id := fn.Args[0]
mn, jn, ok := extractModuleJobName(id)
if !ok {
m.Warningf("dyncfg: update: could not extract module from id (%s)", id)
Method Pipeline.processGroup
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func (p *Pipeline) processGroup(tgg model.TargetGroup) *confgroup.Group {
if len(tgg.Targets()) == 0 {
if _, ok := p.configs[tgg.Source()]; !ok {
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 Scanner.Scan
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func (sc *Scanner) Scan() ([]*Chip, error) {
paths, err := sc.detectDevicePaths()
if err != nil {
return nil, err
}
- 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 Windows.collectNet
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func (w *Windows) collectNet(mx map[string]int64, pms prometheus.Series) {
seen := make(map[string]bool)
px := "net_nic_"
for _, pm := range pms.FindByName(metricNetBytesReceivedTotal) {
if nic := cleanNICID(pm.Labels.Get("nic")); nic != "" {
- 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 NvidiaSmi.collectGPUInfo
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func (nv *NvidiaSmi) collectGPUInfo(mx map[string]int64) error {
bs, err := nv.exec.queryGPUInfo()
if err != nil {
return fmt.Errorf("error on quering XML GPU info: %v", err)
}
- 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 gaugeChartUpdate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
NETDATA.gaugeChartUpdate = function (state, data) {
let value, min, max;
if (NETDATA.globalPanAndZoom.isActive() || state.isAutoRefreshable() === false) {
NETDATA.gaugeSetLabels(state, null, null, null);
- 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 globMatcher.globMatch
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func (m globMatcher) globMatch(name string) (matched bool, err error) {
pattern := string(m)
Pattern:
for len(pattern) > 0 {
var star 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
Function runOnceOnDashboardWithjQuery
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function runOnceOnDashboardWithjQuery() {
if (runOnceOnDashboardLastRun !== 0) {
scrollDashboardTo();
// restore the scrollspy at the proper position
- 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 scan_to_next_token
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def scan_to_next_token(self):
# We ignore spaces, line breaks and comments.
# If we find a line break in the block context, we set the flag
# `allow_simple_key` on.
# The byte order mark is stripped if it's the first character in the
- 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 represent_mapping
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def represent_mapping(self, tag, mapping, flow_style=None):
value = []
node = MappingNode(tag, value, flow_style=flow_style)
if self.alias_key is not None:
self.represented_objects[self.alias_key] = node
- 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 extend
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def extend(self, *args, **kwargs):
"""Generic import function for any type of header-like object.
Adapted version of MutableMapping.update in order to insert items
with self.add instead of self.__setitem__
"""
- 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 run
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
"""
Runs job in thread. Handles retries.
Exits when job failed or timed out.
:return: None
- 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 _get_data
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _get_data(self):
"""
Format data received from http request
:return: dict
"""
- 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 _receive
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _receive(self, raw=False):
"""
Receive data from socket
:param raw: set `True` to return bytes
:type raw: 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
Function _get_raw_data
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _get_raw_data(self, description=None):
"""
Get raw data from MySQL server
:return: dict: fetchall() or (fetchall(), description)
"""
- 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 _get_stat_data
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _get_stat_data(self):
"""
:return: dict
"""
raw_data = self.poll._get_raw_data(self)
- 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 queryBloat
has 72 lines of code (exceeds 50 allowed). Consider refactoring. Open
func queryBloat() string {
return `
SELECT
current_database() AS db, schemaname, tablename, reltuples::bigint AS tups, relpages::bigint AS pages, otta,
ROUND(CASE WHEN otta=0 OR sml.relpages=0 OR sml.relpages=otta THEN 0.0 ELSE sml.relpages/otta::numeric END,1) AS tbloat,
Function c3ChartCreate
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.c3ChartCreate = function(state, data) {
state.element_chart.id = 'c3-' + state.uuid;
// console.log('id = ' + state.element_chart.id);
Function hideChart
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.hideChart = function () {
// hide it, if it is not already hidden
if (isHidden()) {
return;
}