firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

Function positionLabelElements has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    positionLabelElements: function(pie, section, sectionDisplayType) {
        labels["dimensions-" + section] = [];

        // get the latest widths, heights
        var labelGroups = pie.__labels[section];
Severity: Minor
Found in src/web/gui/v1/lib/d3pie-0.2.1-netdata-3.js - About 1 hr to fix

    Function selected_server_timezone has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var selected_server_timezone = function (timezone, status) {
        //console.log('called with timezone: ' + timezone + ", status: " + ((typeof status === 'undefined')?'undefined':status).toString());
    
        // clear the error
        document.getElementById('timezone_error_message').innerHTML = '';
    Severity: Minor
    Found in src/web/gui/main.js - About 1 hr to fix

      Method Pipeline.processGroup has 57 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (p *Pipeline) processGroup(tgg model.TargetGroup) *confgroup.Group {
          if len(tgg.Targets()) == 0 {
              if _, ok := p.configs[tgg.Source()]; !ok {
                  return nil
              }
      Severity: Minor
      Found in src/go/plugin/go.d/agent/discovery/sd/pipeline/pipeline.go - About 1 hr to fix

        Method Gearman.collectStatus has 57 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (g *Gearman) collectStatus(mx map[string]int64, statusData []byte) error {
            /*
                Same output as the "gearadmin --status" command:
        
                FUNCTION\tTOTAL\tRUNNING\tAVAILABLE_WORKERS
        Severity: Minor
        Found in src/go/plugin/go.d/modules/gearman/collect.go - About 1 hr to fix

          Function get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              get: function (state) {
                  if (typeof state.tmp.__commonMax === 'undefined') {
                      // get the commonMax setting
                      state.tmp.__commonMax = NETDATA.dataAttribute(state.element, 'common-max', null);
                  }
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/common.js - About 1 hr to fix

            Function get has 32 lines of code (exceeds 25 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

              Function get has 32 lines of code (exceeds 25 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/v1/dashboard.js - About 1 hr to fix

                Function get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    get: function (state) {
                        if (typeof state.tmp.__commonMax === 'undefined') {
                            // get the commonMax setting
                            state.tmp.__commonMax = NETDATA.dataAttribute(state.element, 'common-max', null);
                        }
                Severity: Minor
                Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                  Function _new_conn has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def _new_conn(self):
                          # Performs the NTLM handshake that secures the connection. The socket
                          # must be kept open while requests are performed.
                          self.num_connections += 1
                          log.debug('Starting NTLM HTTPS connection no. %d: https://%s%s',

                    Method Job.processMetrics has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (j *Job) processMetrics(metrics map[string]int64, startTime time.Time, sinceLastRun int) bool {
                        if !j.vnodeCreated {
                            if j.vnodeGUID == "" {
                                if v := j.module.VirtualNode(); v != nil && v.GUID != "" && v.Hostname != "" {
                                    j.vnodeGUID = v.GUID
                    Severity: Minor
                    Found in src/go/plugin/go.d/agent/module/job.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 Scanner.detectDevicePaths has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (sc *Scanner) detectDevicePaths() ([]string, error) {
                        const lookPath = "/sys/class/hwmon"
                    
                        var paths []string
                    
                    
                    Severity: Minor
                    Found in src/go/plugin/go.d/modules/sensors/lmsensors/scanner.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 Scanner.detectDevicePaths has 13 return statements (exceeds 4 allowed).
                    Open

                    func (sc *Scanner) detectDevicePaths() ([]string, error) {
                        const lookPath = "/sys/class/hwmon"
                    
                        var paths []string
                    
                    
                    Severity: Major
                    Found in src/go/plugin/go.d/modules/sensors/lmsensors/scanner.go - About 1 hr to fix

                      Method Postgres.doQueryGlobalMetrics has 13 return statements (exceeds 4 allowed).
                      Open

                      func (p *Postgres) doQueryGlobalMetrics() error {
                          if err := p.doQueryConnectionsUsed(); err != nil {
                              return fmt.Errorf("querying server connections used error: %v", err)
                          }
                          if err := p.doQueryConnectionsState(); err != nil {
                      Severity: Major
                      Found in src/go/plugin/go.d/modules/postgres/do_query_global.go - About 1 hr to fix

                        Method StorCli.collectMegaraidControllersInfo has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (s *StorCli) collectMegaraidControllersInfo(mx map[string]int64, resp *controllersInfoResponse) error {
                            for _, v := range resp.Controllers {
                                cntrl := v.ResponseData
                        
                                cntrlNum := strconv.Itoa(cntrl.Basics.Controller)
                        Severity: Minor
                        Found in src/go/plugin/go.d/modules/storcli/collect_controllers.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 Apcupsd.collectStatus has a Cognitive Complexity of 26 (exceeds 20 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

                        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 onscrollUpdater has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                        NETDATA.onscrollUpdater = function () {
                            NETDATA.globalSelectionSync.stop();
                        
                            if (NETDATA.options.abort_ajax_on_scroll) {
                                NETDATA.abortAllRefreshes();
                        Severity: Minor
                        Found in src/web/gui/src/dashboard.js/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 renderMyNetdataMenu has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function renderMyNetdataMenu(machinesArray) {
                            const el = document.getElementById('my-netdata-dropdown-content');
                            el.classList.add(`theme-${netdataTheme}`);
                        
                            if (machinesArray == registryAgents) {
                        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 netdataHighlightCallback has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            netdataHighlightCallback: function (status, after, before) {
                                //console.log(2);
                                //console.log(new Error().stack);
                        
                                if (status === true && (after === null || before === null || after <= 0 || before <= 0 || after >= before)) {
                        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 naturalSortCompare has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function naturalSortCompare(a, b) {
                            var aa = naturalSortChunkify(a.toLowerCase());
                            var bb = naturalSortChunkify(b.toLowerCase());
                        
                            for (var x = 0; aa[x] && bb[x]; x++) {
                        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 expect_flow_mapping_key has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def expect_flow_mapping_key(self):
                                if isinstance(self.event, MappingEndEvent):
                                    self.indent = self.indents.pop()
                                    self.flow_level -= 1
                                    if self.canonical:
                        Severity: Minor
                        Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.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

                        Severity
                        Category
                        Status
                        Source
                        Language