TabbycatDebate/tabbycat

View on GitHub
tabbycat/results/result.py

Summary

Maintainability
C
7 hrs
Test Coverage
C
72%

VotingDebateResult has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class VotingDebateResult(BaseDebateResultWithSpeakers):
    """Instantiates a scoresheet for each voting adjudicator, and calculates
    the decision according to a majority vote among them."""

    is_voting = True
Severity: Minor
Found in tabbycat/results/result.py - About 3 hrs to fix

    File result.py has 635 lines of code (exceeds 600 allowed). Consider refactoring.
    Open

    """Debate result classes.
    
    Debate result classes aggregate scoresheets to produce results for an entire
    debate, and interact with the database with respect to models recording scores
    given in the debate. They do not deal with metadata (like motions), only scores
    Severity: Major
    Found in tabbycat/results/result.py - About 2 hrs to fix

      Function sheet_as_dicts has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
      Open

          def sheet_as_dicts(self, sheet):
              """Returns a list of dicts, each being a team in the debate. Used by
              subclasses' `as_dicts()` methods."""
              teams = []
              for side, (side_name, pos_names) in zip(self.sides, side_and_position_names(self.tournament)):
      Severity: Minor
      Found in tabbycat/results/result.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 DebateResult has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
      Open

      def DebateResult(ballotsub, *args, **kwargs):  # noqa: N802 (factory function)
          """Factory function. Returns an instance of a subclass of BaseDebateResult
          appropriate for the ballot submission's tournament's settings.
      
          If `tournament` is provided as a keyword argument, the function wil use this
      Severity: Minor
      Found in tabbycat/results/result.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

      There are no issues that match your filters.

      Category
      Status