opsforgeio/cabot

View on GitHub

Showing 840 of 1,637 total issues

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

    def save(self, *args, **kwargs):
        if self.last_run:
            recent_results = list(self.recent_results())
            if calculate_debounced_passing(recent_results, self.debounce):
                self.calculated_status = Service.CALCULATED_PASSING_STATUS
Severity: Minor
Found in cabot/cabotapp/models.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 minimize_targets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def minimize_targets(targets):
    split = [target.split(".") for target in targets]

    prefix_nodes_in_common = 0
    for i, nodes in enumerate(itertools.izip(*split)):
Severity: Minor
Found in cabot/cabotapp/models.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 parse_metric has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def parse_metric(metric, mins_to_check=5, utcnow=None):
    if utcnow is None:
        utcnow = time.time()
    ret = {
        'num_series_with_data': 0,
Severity: Minor
Found in cabot/cabotapp/graphite.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 update_shifts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def update_shifts():
    events = get_events()
    users = User.objects.filter(is_active=True)
    user_lookup = {}
    for u in users:
Severity: Minor
Found in cabot/cabotapp/models.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 create_viewset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def create_viewset(arg_model, arg_fields, arg_read_only_fields=(), no_create=False):
    arg_read_only_fields = ('id',) + arg_read_only_fields
    for field in arg_read_only_fields:
        if field not in arg_fields:
            arg_fields = arg_fields + (field,)
Severity: Minor
Found in cabot/rest_urls.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

Avoid too many return statements within this function.
Open

            return '';
Severity: Major
Found in cabot/static/theme/js/jquery.sparkline.min.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return;
    Severity: Major
    Found in cabot/static/theme/js/jquery-ui.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return false;
      Severity: Major
      Found in cabot/static/theme/js/jquery-ui.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return null;
        Severity: Major
        Found in cabot/static/theme/js/jquery.dataTables.min.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return s+"px";
          Severity: Major
          Found in cabot/static/theme/js/jquery.dataTables.min.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return 'numeric';
            Severity: Major
            Found in cabot/static/theme/js/jquery.dataTables.min.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return true;
              Severity: Major
              Found in cabot/static/theme/js/jquery-ui.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return sData;
                Severity: Major
                Found in cabot/static/theme/js/jquery.dataTables.min.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return false;
                  Severity: Major
                  Found in cabot/static/theme/js/jquery-ui.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                        return [l, 1];
                    Severity: Major
                    Found in cabot/static/arachnys/js/raphael.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return this;
                      Severity: Major
                      Found in cabot/static/arachnys/js/raphael.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return {r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString};
                        Severity: Major
                        Found in cabot/static/arachnys/js/raphael.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return out;
                          Severity: Major
                          Found in cabot/static/arachnys/js/raphael.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return out;
                            Severity: Major
                            Found in cabot/static/arachnys/js/raphael.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return rgb;
                              Severity: Major
                              Found in cabot/static/arachnys/js/raphael.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language