firehol/netdata

View on GitHub

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 {
Severity: Minor
Found in src/go/plugin/go.d/pkg/prometheus/parse.go - About 1 hr to fix

    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))
    
    
    Severity: Minor
    Found in src/go/plugin/go.d/modules/ap/collect.go - About 1 hr to fix

      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
      Severity: Minor
      Found in src/go/plugin/go.d/modules/gearman/collect.go - About 1 hr to fix

        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) {
        Severity: Minor
        Found in src/web/gui/src/dashboard.js/timeout.js - About 1 hr to fix

          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?
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

            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
                );
            Severity: Minor
            Found in src/web/gui/src/dashboard.js/charting/d3pie.js - About 1 hr to fix

              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) {
              Severity: Minor
              Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                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
                    );
                Severity: Minor
                Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                  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?
                  Severity: Minor
                  Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                    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"))
                    Severity: Minor
                    Found in src/web/gui/v1/dashboard-react.js - About 1 hr to fix

                      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)
                      Severity: Minor
                      Found in src/go/plugin/go.d/modules/intelgpu/exec.go - About 1 hr to fix

                      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{
                      Severity: Major
                      Found in src/go/plugin/go.d/modules/squidlog/charts.go - About 1 hr to fix

                        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)
                            }
                        Severity: Major
                        Found in src/go/plugin/go.d/modules/boinc/client.go - About 1 hr to fix

                          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:"
                              )
                          Severity: Minor
                          Found in src/go/plugin/go.d/modules/fail2ban/collect.go - About 1 hr to fix

                          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 {
                          Severity: Minor
                          Found in src/go/plugin/go.d/pkg/prometheus/parse.go - About 1 hr to fix

                          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() {
                          Severity: Major
                          Found in src/go/plugin/go.d/modules/squidlog/logline.go - About 1 hr to fix

                            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()
                                }
                            Severity: Minor
                            Found in src/go/plugin/go.d/modules/windows/collect_tcp.go - About 1 hr to fix

                            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
                                }
                            Severity: Minor
                            Found in src/go/plugin/go.d/modules/nvidia_smi/exec.go - About 1 hr to fix

                            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);
                                }
                            
                            
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/charting/gauge.js - About 1 hr to fix

                            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);
                                    }
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/common.js - About 1 hr to fix

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language