firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

Function handshake has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def handshake(self,
                  server_hostname,
                  verify,
                  trust_bundle,
                  min_version,

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

def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
                      source_address=None, socket_options=None):
    """Connect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,

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

    def update(self, data, interval):
        updated_dimensions, updated_variables = str(), str()

        for dim in self.dimensions:
            value = dim.get_value(data)
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/bases/charts.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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
        super(MovedAttribute, self).__init__(name)
        if PY3:
            if new_mod is None:
                new_mod = name

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 Pika.addDbToKeyspaceCharts has 60 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (p *Pika) addDbToKeyspaceCharts(db string) {
    p.addDimToChart(chartDbStringsKeys.ID, &module.Dim{
        ID:   db + "_strings_keys",
        Name: db,
    })
Severity: Minor
Found in src/go/plugin/go.d/modules/pika/collect_info.go - About 1 hr to fix

    Method OracleDB.collectTablespace has 60 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (o *OracleDB) collectTablespace(mx map[string]int64) error {
        q := queryTablespace
        o.Debugf("executing query: %s", q)
    
        var ts struct {
    Severity: Minor
    Found in src/go/plugin/go.d/modules/oracledb/collect_tablespace.go - About 1 hr to fix

      Function parseStatus has 60 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func parseStatus(resp []byte) (*apcupsdStatus, error) {
          var st apcupsdStatus
          sc := bufio.NewScanner(bytes.NewBuffer(resp))
      
          for sc.Scan() {
      Severity: Minor
      Found in src/go/plugin/go.d/modules/apcupsd/status.go - About 1 hr to fix

        Method Windows.collectMetrics has 60 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (w *Windows) collectMetrics(mx map[string]int64, pms prometheus.Series) {
            w.collectCollector(mx, pms)
            for _, pm := range pms.FindByName(metricCollectorSuccess) {
                if pm.Value == 0 {
                    continue
        Severity: Minor
        Found in src/go/plugin/go.d/modules/windows/collect.go - About 1 hr to fix

          Function getFixed has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getFixed: function (min, max) {
                  let key = max;
                  if (min === max) {
                      if (typeof this.formattersFixed[key] === 'undefined') {
                          this.formattersFixed[key] = {
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/utils.js - About 1 hr to fix

            Function gaugeSet has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            NETDATA.gaugeSet = function (state, value, min, max) {
                if (typeof value !== 'number') {
                    value = 0;
                }
                if (typeof min !== 'number') {
            Severity: Minor
            Found in src/web/gui/src/dashboard.js/charting/gauge.js - About 1 hr to fix

              Function mouseup has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          mouseup: function (event, dygraph, context) {
                              state.tmp.dygraph_mouse_down = false;
              
                              if (NETDATA.options.debug.dygraph || state.debug) {
                                  state.log('interactionModel.mouseup()');
              Severity: Minor
              Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 hr to fix

                Function downloadAll has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    downloadAll: function (host, callback) {
                        host = NETDATA.fixHost(host);
                
                        let self = this;
                
                
                Severity: Minor
                Found in src/web/gui/src/dashboard.js/chart-registry.js - About 1 hr to fix

                  Function gaugeSet has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  NETDATA.gaugeSet = function (state, value, min, max) {
                      if (typeof value !== 'number') {
                          value = 0;
                      }
                      if (typeof min !== 'number') {
                  Severity: Minor
                  Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                    Function legendFormatValue has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        this.legendFormatValue = function (value) {
                            if (typeof value !== 'number') {
                                return '-';
                            }
                    
                    
                    Severity: Minor
                    Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                      Function downloadAll has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          downloadAll: function (host, callback) {
                              host = NETDATA.fixHost(host);
                      
                              let self = this;
                      
                      
                      Severity: Minor
                      Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                        Function mouseup has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    mouseup: function (event, dygraph, context) {
                                        state.tmp.dygraph_mouse_down = false;
                        
                                        if (NETDATA.options.debug.dygraph || state.debug) {
                                            state.log('interactionModel.mouseup()');
                        Severity: Minor
                        Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                          Function legendFormatValue has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              this.legendFormatValue = function (value) {
                                  if (typeof value !== 'number') {
                                      return '-';
                                  }
                          
                          
                          Severity: Minor
                          Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                            Function getFixed has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                getFixed: function (min, max) {
                                    let key = max;
                                    if (min === max) {
                                        if (typeof this.formattersFixed[key] === 'undefined') {
                                            this.formattersFixed[key] = {
                            Severity: Minor
                            Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                              Function onload has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  fr.onload = function (e) {
                                      document.getElementById('loadSnapshotFilename').innerHTML = filename;
                                      var result = null;
                                      try {
                                          result = NETDATA.xss.checkAlways('snapshot', JSON.parse(e.target.result), /^(snapshot\.info|snapshot\.data)$/);
                              Severity: Minor
                              Found in src/web/gui/main.js - About 1 hr to fix

                                Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def __init__(self, host, port=None, strict=False,
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language