Showing 1,088 of 2,665 total issues
Function getIntlNumberFormat
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getIntlNumberFormat: function (min, max) {
let key = max;
if (min === max) {
if (typeof this.formattersFixed[key] === 'undefined') {
this.formattersFixed[key] = new Intl.NumberFormat(undefined, {
Function delete
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
delete: function (delete_url, callback) {
// send DELETE to a netdata registry:
$.ajax({
url: NETDATA.registry.server + '/api/v1/registry?action=delete&machine=' + NETDATA.registry.machine_guid + '&name=' + encodeURIComponent(NETDATA.registry.hostname) + '&url=' + encodeURIComponent(NETDATA.serverDefault) + '&delete_url=' + encodeURIComponent(delete_url),
async: true,
Function search
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
search: function (machine_guid, callback) {
// SEARCH for the URLs of a machine:
$.ajax({
url: NETDATA.registry.server + '/api/v1/registry?action=search&machine=' + NETDATA.registry.machine_guid + '&name=' + encodeURIComponent(NETDATA.registry.hostname) + '&url=' + encodeURIComponent(NETDATA.serverDefault) + '&for=' + machine_guid,
async: true,
Function switch
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
switch: function (new_person_guid, callback) {
// impersonate
$.ajax({
url: NETDATA.registry.server + '/api/v1/registry?action=switch&machine=' + NETDATA.registry.machine_guid + '&name=' + encodeURIComponent(NETDATA.registry.hostname) + '&url=' + encodeURIComponent(NETDATA.serverDefault) + '&to=' + new_person_guid,
async: true,
Function mergeAgents
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function mergeAgents(cloud, local) {
let dirty = false;
const union = new Map();
Function netdataPrepCallback
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var netdataPrepCallback = function () {
NETDATA.requiredCSS.push({
url: NETDATA.serverStatic + 'css/bootstrap-toggle-2.2.2.min.css',
isAlreadyLoaded: function () {
return false;
Function getGCSLatestVersion
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getGCSLatestVersion(callback) {
versionLog('Downloading latest version id from GCS...');
$.ajax({
url: "https://www.googleapis.com/storage/v1/b/netdata-nightlies/o/latest-version.txt",
async: true,
Function syncAgents
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function syncAgents(callback) {
const json = localStorage.getItem("cloud.sync");
const sync = json ? JSON.parse(json) : {};
const currentAgent = {
Function emit
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def emit(events, stream=None, Dumper=Dumper,
Consider simplifying this complex logical expression. Open
Open
if not double and ch == '\'' and self.peek(1) == '\'':
chunks.append('\'')
self.forward(2)
elif (double and ch == '\'') or (not double and ch in '\"\\'):
chunks.append(ch)
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, scalar, empty, multiline,
Consider simplifying this complex logical expression. Open
Open
if (not (self.simple_key_context and
(self.analysis.empty or self.analysis.multiline))
and (self.flow_level and self.analysis.allow_flow_plain
or (not self.flow_level and self.analysis.allow_block_plain))):
return ''
Function urlopen
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def urlopen(self, method, url, body=None, headers=None,
Function handshake
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def handshake(self,
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, host, port=None, key_file=None, cert_file=None,
Method Manager.dyncfgConfigUpdate
has 9 return statements (exceeds 4 allowed). Open
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 Discoverer.parseLocalListeners
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
func (d *Discoverer) parseLocalListeners(bs []byte) ([]model.Target, error) {
const (
local4 = "127.0.0.1"
local6 = "::1"
)
- 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 readICMPResponse
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
func readICMPResponse(icmpConn *icmp.PacketConn, udpConn *net.UDPConn, icmpProto int, timeout time.Duration) (bool, error) {
buff := make([]byte, 1500)
if err := icmpConn.SetReadDeadline(time.Now().Add(timeout)); err != nil {
return false, fmt.Errorf("failed to set read deadline on ICMP connection: %w", 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 checkChart
has 9 return statements (exceeds 4 allowed). Open
Open
func checkChart(chart *Chart) error {
if chart.ID == "" {
return errors.New("empty ID")
}
Method SNMP.collectNetworkInterfaces
has 9 return statements (exceeds 4 allowed). Open
Open
func (s *SNMP) collectNetworkInterfaces(mx map[string]int64) error {
if s.checkMaxReps {
ok, err := s.adjustMaxRepetitions()
if err != nil {
return err