firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

Function hideChart has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    this.hideChart = function () {
        // hide it, if it is not already hidden
        if (isHidden()) {
            return;
        }
Severity: Minor
Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

    Function dump_all has 15 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def dump_all(documents, stream=None, Dumper=Dumper,
    Severity: Major
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/__init__.py - About 1 hr to fix

      Method Discoverer.parseLocalListeners has 71 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (d *Discoverer) parseLocalListeners(bs []byte) ([]model.Target, error) {
          const (
              local4 = "127.0.0.1"
              local6 = "::1"
          )

        Method Windows.collectLogicalDisk has 71 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (w *Windows) collectLogicalDisk(mx map[string]int64, pms prometheus.Series) {
            seen := make(map[string]bool)
            px := "logical_disk_"
            for _, pm := range pms.FindByName(metricLDReadBytesTotal) {
                vol := pm.Labels.Get("volume")
        Severity: Minor
        Found in src/go/plugin/go.d/modules/windows/collect_logical_disk.go - About 1 hr to fix

          Function addTooltips has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              addTooltips: function(pie) {
          
              // group the label groups (label, percentage, value) into a single element for simpler positioning
              var tooltips = pie.svg.insert("g")
                  .attr("class", pie.cssPrefix + "tooltips");
          Severity: Minor
          Found in src/web/gui/v1/lib/d3pie-0.2.1-netdata-3.js - About 1 hr to fix

            Method Apcupsd.collectStatus has 70 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (a *Apcupsd) collectStatus(mx map[string]int64, resp []byte) error {
                st, err := parseStatus(resp)
                if err != nil {
                    return fmt.Errorf("failed to parse status: %v", err)
                }
            Severity: Minor
            Found in src/go/plugin/go.d/modules/apcupsd/collect.go - About 1 hr to fix

              Method Docker.collectContainers has 70 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (d *Docker) collectContainers(mx map[string]int64) error {
                  containerSet := make(map[string][]types.Container)
              
                  for _, status := range containerHealthStatuses {
                      if err := func() error {
              Severity: Minor
              Found in src/go/plugin/go.d/modules/docker/collect.go - About 1 hr to fix

                Method Ceph.collectHealth has 70 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (c *Ceph) collectHealth(mx map[string]int64) error {
                    req, err := web.NewHTTPRequestWithPath(c.RequestConfig, urlPathApiHealthMinimal)
                    if err != nil {
                        return err
                    }
                Severity: Minor
                Found in src/go/plugin/go.d/modules/ceph/collect_health.go - About 1 hr to fix

                  Function finalizePage has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function finalizePage() {
                      // resize all charts - without starting the background thread
                      // this has to be done while NETDATA is paused
                      // if we omit this, the affix menu will be wrong, since all
                      // the Dom elements are initially zero-sized
                  Severity: Minor
                  Found in src/web/gui/main.js - About 1 hr to fix

                    Method Manager.dyncfgConfigEnable has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (m *Manager) dyncfgConfigEnable(fn functions.Function) {
                        id := fn.Args[0]
                        mn, jn, ok := extractModuleJobName(id)
                        if !ok {
                            m.Warningf("dyncfg: enable: could not extract module and job from id (%s)", id)
                    Severity: Minor
                    Found in src/go/plugin/go.d/agent/jobmgr/dyncfg.go - About 1 hr to fix

                      Method Postgres.resetMetrics has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (p *Postgres) resetMetrics() {
                          p.mx.srvMetrics = srvMetrics{
                              xactTimeHist:   p.mx.xactTimeHist,
                              queryTimeHist:  p.mx.queryTimeHist,
                              maxConnections: p.mx.maxConnections,
                      Severity: Minor
                      Found in src/go/plugin/go.d/modules/postgres/collect_metrics.go - About 1 hr to fix

                        Method Agent.buildDiscoveryConf has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (a *Agent) buildDiscoveryConf(enabled module.Registry) discovery.Config {
                            a.Info("building discovery config")
                        
                            reg := confgroup.Registry{}
                            for name, creator := range enabled {
                        Severity: Minor
                        Found in src/go/plugin/go.d/agent/setup.go - About 1 hr to fix

                          Function postCloudAccountAgents has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function postCloudAccountAgents(agentsToSync) {
                              if (!isSignedIn()) {
                                  return [];
                              }
                          
                          
                          Severity: Minor
                          Found in src/web/gui/main.js - About 1 hr to fix

                            Method logLine.verify has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (l *logLine) verify() error {
                                if l.empty() {
                                    return fmt.Errorf("verify: %w", errEmptyLine)
                                }
                                if l.hasRespCode() && !l.isRespCodeValid() {
                            Severity: Minor
                            Found in src/go/plugin/go.d/modules/weblog/logline.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 init has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                init: function () {
                                    if (netdataRegistry !== true) {
                                        return;
                                    }
                            
                            
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/registry.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 initializeDynamicDashboardWithData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function initializeDynamicDashboardWithData(data) {
                                if (data !== null) {
                                    options.hostname = data.hostname;
                                    options.data = data;
                                    options.version = data.version;
                            Severity: Minor
                            Found in src/web/gui/main.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 loadSnapshotPreflightFile has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function loadSnapshotPreflightFile(file) {
                                var filename = NETDATA.xss.string(file.name);
                                var fr = new FileReader();
                                fr.onload = function (e) {
                                    document.getElementById('loadSnapshotFilename').innerHTML = filename;
                            Severity: Minor
                            Found in src/web/gui/main.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 parse_flow_mapping_key has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def parse_flow_mapping_key(self, first=False):
                                    if not self.check_token(FlowMappingEndToken):
                                        if not first:
                                            if self.check_token(FlowEntryToken):
                                                self.get_token()
                            Severity: Minor
                            Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py - 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 scan_tag has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def scan_tag(self):
                                    # See the specification for details.
                                    start_mark = self.get_mark()
                                    ch = self.peek(1)
                                    if ch == '<':
                            Severity: Minor
                            Found in src/collectors/python.d.plugin/python_modules/pyyaml3/scanner.py - 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 __init__ has 14 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def __init__(self, body='', headers=None, status=0, version=0, reason=None,
                            Severity: Major
                            Found in src/collectors/python.d.plugin/python_modules/urllib3/response.py - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language