rgmining/synthetic

View on GitHub

Showing 5 of 56 total issues

Function calc_anomalous_reviews has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def calc_anomalous_reviews(reviewers: Iterable[Reviewer]) -> AnomalousReviews:
    """Counts the number of anomalous reviewers.

    Args:
      reviewers: A collection of reviewers.
Severity: Minor
Found in synthetic/eval/score.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 ranking has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def ranking(
Severity: Minor
Found in synthetic/eval/cli.py - About 35 mins to fix

    Function threshold has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def threshold(
    Severity: Minor
    Found in synthetic/eval/cli.py - About 35 mins to fix

      Function dcg has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def dcg(method: str, loop: int, param: list[tuple[str, str]], output: TextIO, plot: Optional[BinaryIO] = None) -> None:
      Severity: Minor
      Found in synthetic/eval/cli.py - About 35 mins to fix

        Function dcg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def dcg(reviewers: Iterable[Reviewer], k: int) -> float:
            """Computes a DCG score for a top-k ranking.
        
            Args:
              reviewers: A collection of reviewers.
        Severity: Minor
        Found in synthetic/eval/score.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