firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

Method Typesense.collectStats has 5 return statements (exceeds 4 allowed).
Open

func (ts *Typesense) collectStats(mx map[string]int64) error {
    if !ts.doStats || ts.APIKey == "" {
        return nil
    }

Severity: Major
Found in src/go/plugin/go.d/modules/typesense/collect.go - About 35 mins to fix

    Method DNSQuery.verifyConfig has 5 return statements (exceeds 4 allowed).
    Open

    func (d *DNSQuery) verifyConfig() error {
        if len(d.Domains) == 0 {
            return errors.New("no domains specified")
        }
    
    
    Severity: Major
    Found in src/go/plugin/go.d/modules/dnsquery/init.go - About 35 mins to fix

      Function getUser has 5 return statements (exceeds 4 allowed).
      Open

      func getUser() (user string) {
          if user = os.Getenv("LOGNAME"); user != "" {
              return user
          }
          if user = os.Getenv("USER"); user != "" {
      Severity: Major
      Found in src/go/plugin/go.d/modules/mysql/mycnf.go - About 35 mins to fix

        Function dygraphGetSeriesStyle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        NETDATA.dygraphGetSeriesStyle = function(dygraphOptions) {
            const seriesStyleStr = dygraphOptions.perSeriesStyle;
            let formattedStyles = {};
        
            if (seriesStyleStr === '') {
        Severity: Minor
        Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 35 mins 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 getLocaleString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            getLocaleString: 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 35 mins 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 getIntlNumberFormat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            getIntlNumberFormat: function (min, max) {
                let key = max;
                if (min === max) {
                    if (typeof this.formattersFixed[key] === 'undefined') {
                        this.formattersFixed[key] = new Intl.NumberFormat(undefined, {
        Severity: Minor
        Found in src/web/gui/src/dashboard.js/utils.js - About 35 mins 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 Reader.open has 5 return statements (exceeds 4 allowed).
        Open

        func (r *Reader) open() error {
            path := r.findFile()
            if path == "" {
                r.log.Debugf("couldn't find log file, used path: '%s', exclude_path: '%s'", r.path, r.excludePath)
                return ErrNoMatchedFile
        Severity: Major
        Found in src/go/plugin/go.d/pkg/logs/reader.go - About 35 mins to fix

          Function easypiechartSetSelection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          NETDATA.easypiechartSetSelection = function (state, t) {
              if (state.timeIsVisible(t) !== true) {
                  return NETDATA.easypiechartClearSelection(state, true);
              }
          
          
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/charting/easy-pie-chart.js - About 35 mins 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 selected2BooleanArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          dimensionsVisibility.prototype.selected2BooleanArray = function (array) {
              let ret = [];
              this.selected_count = 0;
              this.unselected_count = 0;
          
          
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/main.js - About 35 mins 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 globMatcher.globMatch has 5 return statements (exceeds 4 allowed).
          Open

          func (m globMatcher) globMatch(name string) (matched bool, err error) {
              pattern := string(m)
          Pattern:
              for len(pattern) > 0 {
                  var star bool
          Severity: Major
          Found in src/go/pkg/matcher/glob.go - About 35 mins to fix

            Function loadRequiredJs has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 setMaster has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                setMaster: function (state) {
                    if (!this.enabled()) {
                        this.stop();
                        return;
                    }
            Severity: Minor
            Found in src/web/gui/src/dashboard.js/main.js - About 35 mins 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 prepare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                prepare: function (state) {
                    let has_custom_colors = false;
            
                    if (typeof state.tmp.__commonColors === 'undefined') {
                        let defname = state.chart.context;
            Severity: Minor
            Found in src/web/gui/src/dashboard.js/common.js - About 35 mins 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 Duration.UnmarshalYAML has 5 return statements (exceeds 4 allowed).
            Open

            func (d *Duration) UnmarshalYAML(unmarshal func(any) error) error {
                var s string
            
                if err := unmarshal(&s); err != nil {
                    return err
            Severity: Major
            Found in src/go/plugin/go.d/pkg/confopt/duration.go - About 35 mins to fix

              Function Open has 5 return statements (exceeds 4 allowed).
              Open

              func Open(path string, excludePath string, log *logger.Logger) (*Reader, error) {
                  var err error
                  if path, err = filepath.Abs(path); err != nil {
                      return nil, err
                  }
              Severity: Major
              Found in src/go/plugin/go.d/pkg/logs/reader.go - About 35 mins to fix

                Function d3pieChartCreate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                NETDATA.d3pieChartCreate = function (state, data) {
                
                    state.element_chart.id = 'd3pie-' + state.uuid;
                    // console.log('id = ' + state.element_chart.id);
                
                
                Severity: Minor
                Found in src/web/gui/src/dashboard.js/charting/d3pie.js - About 35 mins 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 alarmsCallback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function alarmsCallback(data) {
                    var count = 0, x;
                    for (x in data.alarms) {
                        if (!data.alarms.hasOwnProperty(x)) {
                            continue;
                Severity: Minor
                Found in src/web/gui/main.js - About 35 mins 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_block_scalar_indentation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def scan_block_scalar_indentation(self):
                        # See the specification for details.
                        chunks = []
                        max_indent = 0
                        end_mark = self.get_mark()
                Severity: Minor
                Found in src/collectors/python.d.plugin/python_modules/pyyaml3/scanner.py - About 35 mins 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_flow_scalar_spaces has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def scan_flow_scalar_spaces(self, double, start_mark):
                        # See the specification for details.
                        chunks = []
                        length = 0
                        while self.peek(length) in ' \t':
                Severity: Minor
                Found in src/collectors/python.d.plugin/python_modules/pyyaml3/scanner.py - About 35 mins 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 determine_block_hints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def determine_block_hints(self, text):
                        hints = ''
                        if text:
                            if text[0] in ' \n\x85\u2028\u2029':
                                hints += str(self.best_indent)
                Severity: Minor
                Found in src/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py - About 35 mins 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