firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

Function update has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self, interval):
        """
        :return:
        """
        data = self.get_data()

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

    def _parse_extra_charts_config(self, extra_charts_config):

        # a place to store the expvar keys and their types
        self.expvars = list()

Severity: Minor
Found in src/collectors/python.d.plugin/go_expvar/go_expvar.chart.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 backport_makefile has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def backport_makefile(self, mode="r", buffering=None, encoding=None,
                      errors=None, newline=None):
    """
    Backport of ``socket.makefile`` from Python 3.5.
    """

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

    def _make_request(self, conn, method, url, timeout=_Default, chunked=False,
                      **httplib_request_kw):
        """
        Perform a request on a given urllib connection object taken from our
        pool.

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

    def read(self, amt=None, decode_content=None, cache_content=False):
        """
        Similar to :meth:`httplib.HTTPResponse.read`, but with two additional
        parameters: ``decode_content`` and ``cache_content``.

Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/urllib3/response.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 request_chunked has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def request_chunked(self, method, url, body=None, headers=None):
        """
        Alternative to the common request method, which sends the
        body with chunked encoding and not as one block
        """
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/urllib3/connection.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

Method Mongo.addOptionalCharts has 68 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (m *Mongo) addOptionalCharts(s *documentServerStatus) {
    m.addOptionalChart(s.OpLatencies,
        &chartOperationsRate,
        &chartOperationsLatencyTime,
    )
Severity: Minor
Found in src/go/plugin/go.d/modules/mongodb/collect_serverstatus.go - About 1 hr to fix

    Method StorCli.collectMegaRaidDrives has 68 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (s *StorCli) collectMegaRaidDrives(mx map[string]int64, resp *drivesInfoResponse) error {
        if resp == nil {
            return nil
        }
    
    
    Severity: Minor
    Found in src/go/plugin/go.d/modules/storcli/collect_drives.go - About 1 hr to fix

      Method Hpssa.updateCharts has 68 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (h *Hpssa) updateCharts(controllers map[string]*hpssaController) {
          seenControllers := make(map[string]bool)
          seenArrays := make(map[string]bool)
          seenLDrives := make(map[string]bool)
          seenPDrives := make(map[string]bool)
      Severity: Minor
      Found in src/go/plugin/go.d/modules/hpssa/charts.go - About 1 hr to fix

        Function collectSwarmManager has 68 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func collectSwarmManager(mx *metrics, raw prometheus.Series) {
            v := raw.FindByName("swarm_manager_configs_total").Max()
            mx.SwarmManager.Configs = v
        
            v = raw.FindByName("swarm_manager_networks_total").Max()
        Severity: Minor
        Found in src/go/plugin/go.d/modules/docker_engine/collect.go - About 1 hr to fix

          Function easypiechartPercentFromValueMinMax has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          NETDATA.easypiechartPercentFromValueMinMax = 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/easy-pie-chart.js - About 1 hr to fix

            Function start has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            NETDATA.start = function () {
                // this should be called only once
            
                if (NETDATA.started) {
                    console.log('netdata is already started');
            Severity: Minor
            Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

              Function start has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              NETDATA.start = function () {
                  // this should be called only once
              
                  if (NETDATA.started) {
                      console.log('netdata is already started');
              Severity: Minor
              Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

                Function easypiechartPercentFromValueMinMax has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                NETDATA.easypiechartPercentFromValueMinMax = 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 create has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      create: function(pie) {
                          var pieCenter = pie.pieCenter;
                          var colors = pie.options.colors;
                          var loadEffects = pie.options.effects.load;
                          var segmentStroke = pie.options.misc.colors.segmentStroke;
                  Severity: Minor
                  Found in src/web/gui/v1/lib/d3pie-0.2.1-netdata-3.js - About 1 hr to fix

                    Method Agent.run has 67 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (a *Agent) run(ctx context.Context) {
                        a.Info("instance is started")
                        defer func() { a.Info("instance is stopped") }()
                    
                        cfg := a.loadPluginConfig()
                    Severity: Minor
                    Found in src/go/plugin/go.d/agent/agent.go - About 1 hr to fix

                      Method Postgres.doQueryQueryableDatabases has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (p *Postgres) doQueryQueryableDatabases() error {
                          q := queryQueryableDatabaseList()
                      
                          var dbs []string
                          err := p.doQuery(q, func(_, value string, _ bool) {
                      Severity: Minor
                      Found in src/go/plugin/go.d/modules/postgres/do_query_misc.go - About 1 hr to fix

                        Method Windows.collectAD has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (w *Windows) collectAD(mx map[string]int64, pms prometheus.Series) {
                            if !w.cache.collection[collectorAD] {
                                w.cache.collection[collectorAD] = true
                                w.addADCharts()
                            }
                        Severity: Minor
                        Found in src/go/plugin/go.d/modules/windows/collect_ad.go - About 1 hr to fix

                          Method Windows.collectProcess has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (w *Windows) collectProcess(mx map[string]int64, pms prometheus.Series) {
                              if !w.cache.collection[collectorProcess] {
                                  w.cache.collection[collectorProcess] = true
                                  w.addProcessesCharts()
                              }
                          Severity: Minor
                          Found in src/go/plugin/go.d/modules/windows/collect_process.go - About 1 hr to fix

                            Function loadRequiredJs has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            NETDATA.loadRequiredJs = function (index, callback) {
                                if (index >= NETDATA.requiredJs.length) {
                                    if (typeof callback === 'function') {
                                        return callback();
                                    }
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/boot.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language