Showing 1,088 of 2,665 total issues
Method ProxySQL.collect
has 7 return statements (exceeds 4 allowed). Open
func (p *ProxySQL) collect() (map[string]int64, error) {
if p.db == nil {
if err := p.openConnection(); err != nil {
return nil, err
}
Method Ceph.authLogin
has 7 return statements (exceeds 4 allowed). Open
func (c *Ceph) authLogin() (string, error) {
// https://docs.ceph.com/en/reef/mgr/ceph_api/#post--api-auth
req, err := func() (*http.Request, error) {
var credentials = struct {
Method Dnsmasq.collectCacheStatistics
has 7 return statements (exceeds 4 allowed). 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:
Method HDFS.determineNodeType
has 7 return statements (exceeds 4 allowed). Open
func (h *HDFS) determineNodeType() (nodeType, error) {
req, err := web.NewHTTPRequest(h.RequestConfig)
if err != nil {
return "", fmt.Errorf("failed to create HTTP request: %v", err)
}
Function dataAttributeBoolean
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
NETDATA.dataAttributeBoolean = function (element, attribute, def) {
let value = NETDATA.dataAttribute(element, attribute, def);
if (value === true || value === false) // gmosx: Love this :)
{
- 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 setMaster
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
setMaster: function (state, after, before) {
this.delay();
if (!NETDATA.options.current.sync_pan_and_zoom) {
return;
- 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 setOption
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
NETDATA.setOption = function (key, value) {
if (key.toString() === 'setOptionCallback') {
if (typeof NETDATA.options.current.setOptionCallback === 'function') {
NETDATA.options.current[key.toString()] = value;
NETDATA.options.current.setOptionCallback();
- 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
Avoid deeply nested control flow statements. Open
if (this.convertibleUnits[units].hasOwnProperty(x)) {
if (this.convertibleUnits[units][x].check(max)) {
//console.log('DEBUG: ' + uuid.toString() + ' converting ' + units.toString() + ' to: ' + x.toString());
switch_units_callback(x);
return this.convertibleUnits[units][x].convert;
Function init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
init: function () {
let custom = true;
if (window.requestAnimationFrame) {
this.step = function (callback) {
- 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
Avoid deeply nested control flow statements. Open
if len(pattern) == 0 && len(t) > 0 {
continue
}
Function setup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
setup: function () {
if (this.isActive()) {
if (this.state === null) {
this.state = NETDATA.options.targets[0];
}
- 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 setOptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
dimensionStatus.prototype.setOptions = function (name_div, value_div, color) {
this.color = color;
if (this.name_div !== name_div) {
this.name_div = name_div;
- 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
Avoid deeply nested control flow statements. Open
if hi, chunk, err = getEsc(chunk[1:]); err != nil {
return
}
Avoid deeply nested control flow statements. Open
if (t.hasOwnProperty(x) && t[x].divider > common_units.divider) {
common_units = t[x];
}
Method API.DIMENSION
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
ID string,
name string,
algorithm string,
multiplier int,
divisor int,
Avoid deeply nested control flow statements. Open
if (this.convertibleUnits[units].hasOwnProperty(x)) {
if (this.convertibleUnits[units][x].check(max)) {
//console.log('DEBUG: ' + uuid.toString() + ' converting ' + units.toString() + ' to: ' + x.toString());
switch_units_callback(x);
return this.convertibleUnits[units][x].convert;
Avoid deeply nested control flow statements. Open
if (t.hasOwnProperty(x) && t[x].divider > common_units.divider) {
common_units = t[x];
}
Function activeForRecipients
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
activeForRecipients: function () {
let active = {};
let data = NETDATA.alarms.current;
if (typeof data === 'undefined' || data === 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
Avoid deeply nested control flow statements. Open
if element['name'] != 'netdata-repo' and element['name'] != 'netdata-repo-edge':
all_pkg_list.append(element)
page += 1
Function send
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send(self, out_type, out_data):
if self.socket is None:
raise MCRconException("Must connect before sending data")
# Send a request packet
- 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"