matejak/estimagus

View on GitHub

Showing 14 of 16 total issues

File routes.py has 316 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import datetime
import collections

import flask
import flask_login
Severity: Minor
Found in estimage/webapp/main/routes.py - About 3 hrs to fix

    File __init__.py has 298 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import dataclasses
    import datetime
    import collections
    import typing
    
    
    Severity: Minor
    Found in estimage/plugins/jira/__init__.py - About 3 hrs to fix

      File persons.py has 279 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import dataclasses
      import typing
      import collections
      
      import numpy as np
      Severity: Minor
      Found in estimage/persons.py - About 2 hrs to fix

        Progress has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Progress:
            start: datetime.datetime
            end: datetime.datetime
            points_timeline: timeline.Timeline
            status_timeline: timeline.Timeline
        Severity: Minor
        Found in estimage/history/progress.py - About 2 hrs to fix

          Importer has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Importer(importer.BareboneImporter):
              def __init__(self, spec):
                  super().__init__(spec)
          
                  self._import_context = "none"
          Severity: Minor
          Found in estimage/plugins/jira/__init__.py - About 2 hrs to fix

            Function _get_event_from_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def _get_event_from_data(self, data_dict, name):
                    time = datetime.datetime.fromisoformat(data_dict["time"])
                    ret = data.Event(name, data_dict["quantity"] or None, time)
                    if "value_before" in data_dict:
                        ret.value_before = data_dict["value_before"]
            Severity: Minor
            Found in estimage/persistence/event/ini.py - About 55 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 _get_owner_epic_of has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _get_owner_epic_of(self, assignee, committed):
                    if not assignee:
                        assignee = "nobody"
                    name = f"{PROJECT_NAME}-{assignee}"
                    if committed:
            Severity: Minor
            Found in estimage/plugins/crypto/__init__.py - About 45 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 process_events has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def process_events(self, events: typing.Iterable[data.Event]):
                    if not events:
                        return
                    events_from_oldest = sorted(events, key=lambda x: x.time)
                    events_from_newest = events_from_oldest[::-1]
            Severity: Minor
            Found in estimage/history/timeline.py - About 45 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_class_io_with_extension has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _update_class_io_with_extension(self, new_class, original_class, extension):
                    if original_class not in persistence.LOADERS or original_class not in persistence.LOADERS:
                        return
            
                    for backend, loader in persistence.LOADERS[original_class].items():
            Severity: Minor
            Found in estimage/__init__.py - About 45 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 jira_retry_n has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def jira_retry_n(retries, longest_pause, func, * args, ** kwargs):
            Severity: Minor
            Found in estimage/plugins/jira/importer.py - About 35 mins to fix

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

              def move_consensus_estimate_to_authoritative(task_name):
                  form = flask.current_app.get_final_class("AuthoritativeForm")()
                  if form.validate_on_submit():
                      if form.i_kid_you_not.data:
                          pollster_cons = webdata.AuthoritativePollster()
              Severity: Minor
              Found in estimage/webapp/main/routes.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 _accepted has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _accepted(cls, jira_string, item):
                      resolution = item.get_field("resolution")
                      resolution_text = ""
                      if resolution:
                          resolution_text = resolution.name
              Severity: Minor
              Found in estimage/plugins/crypto/__init__.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 cost_matrix has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def cost_matrix(self):
                      ret = np.ones((len(self.persons_potential), len(self.cards_by_name)))
                      ret *= np.inf
                      for collab_idx, collab_name in enumerate(self.persons_potential):
                          for task_idx, task_name in enumerate(self.cards_by_name):
              Severity: Minor
              Found in estimage/persons.py - About 25 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 act_on_global_estimate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def act_on_global_estimate(task_name):
                  r = routers.PollsterRouter()
                  form = forms.ConsensusForm()
                  if form.validate_on_submit():
                      if form.submit.data and form.i_kid_you_not.data:
              Severity: Minor
              Found in estimage/webapp/main/routes.py - About 25 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