Showing 1,088 of 2,665 total issues
Method promTextParser.parseToMetricFamilies
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *promTextParser) parseToMetricFamilies(text []byte) (MetricFamilies, error) {
p.reset()
parser := textparse.NewPromParser(text)
for {
Function parseIwStationStatistics
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func parseIwStationStatistics(resp []byte) (*stationStats, error) {
var stats stationStats
sc := bufio.NewScanner(bytes.NewReader(resp))
Method Gearman.collectPriorityStatus
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (g *Gearman) collectPriorityStatus(mx map[string]int64, prioStatusData []byte) error {
/*
Same output as the "gearadmin --priority-status" command:
FUNCTION\tHIGH\tNORMAL\tLOW\tAVAILABLE_WORKERS
Function init
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function () {
let custom = true;
if (window.requestAnimationFrame) {
this.step = function (callback) {
Function runtimeInit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const runtimeInit = () => {
this.paused = false; // boolean - is the chart paused for any reason?
this.selected = false; // boolean - is the chart shown a selection?
this.chart_created = false; // boolean - is the library.create() been called?
Function d3pieSetContent
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.d3pieSetContent = function (state, data, index) {
state.legendFormatValueDecimalsFromMinMax(
data.min,
data.max
);
Function init
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function () {
let custom = true;
if (window.requestAnimationFrame) {
this.step = function (callback) {
Function d3pieSetContent
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.d3pieSetContent = function (state, data, index) {
state.legendFormatValueDecimalsFromMinMax(
data.min,
data.max
);
Function runtimeInit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const runtimeInit = () => {
this.paused = false; // boolean - is the chart paused for any reason?
this.selected = false; // boolean - is the chart shown a selection?
this.chart_created = false; // boolean - is the library.create() been called?
Function registrySearch
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
NETDATA.registrySearch = function (machine_guid, getFromRegistry, serverDefault, callback) {
// SEARCH for the URLs of a machine:
$.ajax({
url: getFromRegistry("registryServer") + '/api/v1/registry?action=search&machine='
+ getFromRegistry("machineGuid") + '&name=' + encodeURIComponent(getFromRegistry("hostname"))
Method intelGpuTopExec.run
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (e *intelGpuTopExec) run() error {
var cmd *exec.Cmd
if e.device != "" {
cmd = exec.Command(e.ndsudoPath, "igt-device-json", "--interval", e.calcIntervalArg(), "--device", e.device)
- 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 SquidLog.createCharts
has 11 return statements (exceeds 4 allowed). Open
func (s *SquidLog) createCharts(line *logLine) error {
if line.empty() {
return errors.New("empty line")
}
charts := &Charts{
Method boincClient.send
has 11 return statements (exceeds 4 allowed). Open
func (c *boincClient) send(req *boincRequest) (*boincReply, error) {
reqData, err := xml.Marshal(req)
if err != nil {
return nil, fmt.Errorf("failed to marshal request: %v", err)
}
Function parseFail2banJailStatus
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func parseFail2banJailStatus(jailStatus []byte) (failed, banned int64, err error) {
const (
failedSub = "Currently failed:"
bannedSub = "Currently banned:"
)
- 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 promTextParser.parseToMetricFamilies
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (p *promTextParser) parseToMetricFamilies(text []byte) (MetricFamilies, error) {
p.reset()
parser := textparse.NewPromParser(text)
for {
- 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 logLine.verify
has 11 return statements (exceeds 4 allowed). Open
func (l logLine) verify() error {
if l.empty() {
return fmt.Errorf("verify: %w", errEmptyLine)
}
if l.hasRespTime() && !l.isRespTimeValid() {
Method Windows.collectTCP
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (w *Windows) collectTCP(mx map[string]int64, pms prometheus.Series) {
if !w.cache.collection[collectorTCP] {
w.cache.collection[collectorTCP] = true
w.addTCPCharts()
}
- 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 nvidiaSmiLoopExec.run
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (e *nvidiaSmiLoopExec) run() error {
secs := 5
if e.updateEvery < secs {
secs = e.updateEvery
}
- 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 gaugeSetSelection
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
NETDATA.gaugeSetSelection = function (state, t) {
if (state.timeIsVisible(t) !== true) {
return NETDATA.gaugeClearSelection(state, true);
}
- 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
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
get: function (state) {
if (typeof state.tmp.__commonMin === 'undefined') {
// get the commonMin setting
state.tmp.__commonMin = NETDATA.dataAttribute(state.element, 'common-min', 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"