Showing 1,088 of 2,665 total issues
Function update
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update(self, interval):
"""
:return:
"""
data = self.get_data()
- 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 _parse_extra_charts_config
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _parse_extra_charts_config(self, extra_charts_config):
# a place to store the expvar keys and their types
self.expvars = list()
- 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 backport_makefile
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def backport_makefile(self, mode="r", buffering=None, encoding=None,
errors=None, newline=None):
"""
Backport of ``socket.makefile`` from Python 3.5.
"""
- 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 _make_request
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _make_request(self, conn, method, url, timeout=_Default, chunked=False,
**httplib_request_kw):
"""
Perform a request on a given urllib connection object taken from our
pool.
- 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 read
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def read(self, amt=None, decode_content=None, cache_content=False):
"""
Similar to :meth:`httplib.HTTPResponse.read`, but with two additional
parameters: ``decode_content`` and ``cache_content``.
- 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 request_chunked
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def request_chunked(self, method, url, body=None, headers=None):
"""
Alternative to the common request method, which sends the
body with chunked encoding and not as one block
"""
- 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 Mongo.addOptionalCharts
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *Mongo) addOptionalCharts(s *documentServerStatus) {
m.addOptionalChart(s.OpLatencies,
&chartOperationsRate,
&chartOperationsLatencyTime,
)
Method StorCli.collectMegaRaidDrives
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *StorCli) collectMegaRaidDrives(mx map[string]int64, resp *drivesInfoResponse) error {
if resp == nil {
return nil
}
Method Hpssa.updateCharts
has 68 lines of code (exceeds 50 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)
Function collectSwarmManager
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func collectSwarmManager(mx *metrics, raw prometheus.Series) {
v := raw.FindByName("swarm_manager_configs_total").Max()
mx.SwarmManager.Configs = v
v = raw.FindByName("swarm_manager_networks_total").Max()
Function easypiechartPercentFromValueMinMax
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.easypiechartPercentFromValueMinMax = function (state, value, min, max) {
if (typeof value !== 'number') {
value = 0;
}
if (typeof min !== 'number') {
Function start
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.start = function () {
// this should be called only once
if (NETDATA.started) {
console.log('netdata is already started');
Function start
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.start = function () {
// this should be called only once
if (NETDATA.started) {
console.log('netdata is already started');
Function easypiechartPercentFromValueMinMax
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.easypiechartPercentFromValueMinMax = function (state, value, min, max) {
if (typeof value !== 'number') {
value = 0;
}
if (typeof min !== 'number') {
Function create
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
create: function(pie) {
var pieCenter = pie.pieCenter;
var colors = pie.options.colors;
var loadEffects = pie.options.effects.load;
var segmentStroke = pie.options.misc.colors.segmentStroke;
Method Agent.run
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *Agent) run(ctx context.Context) {
a.Info("instance is started")
defer func() { a.Info("instance is stopped") }()
cfg := a.loadPluginConfig()
Method Postgres.doQueryQueryableDatabases
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *Postgres) doQueryQueryableDatabases() error {
q := queryQueryableDatabaseList()
var dbs []string
err := p.doQuery(q, func(_, value string, _ bool) {
Method Windows.collectAD
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (w *Windows) collectAD(mx map[string]int64, pms prometheus.Series) {
if !w.cache.collection[collectorAD] {
w.cache.collection[collectorAD] = true
w.addADCharts()
}
Method Windows.collectProcess
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (w *Windows) collectProcess(mx map[string]int64, pms prometheus.Series) {
if !w.cache.collection[collectorProcess] {
w.cache.collection[collectorProcess] = true
w.addProcessesCharts()
}
Function loadRequiredJs
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.loadRequiredJs = function (index, callback) {
if (index >= NETDATA.requiredJs.length) {
if (typeof callback === 'function') {
return callback();
}