ionelmc/pytest-benchmark

View on GitHub

Showing 47 of 49 total issues

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

    def warning(self, text, warner=None, suspend=False):
        if self.level >= self.VERBOSE:
            if suspend and self.suspend_capture:
                self.suspend_capture(in_=True)
            self.term.line('')
Severity: Minor
Found in src/pytest_benchmark/logger.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 __call__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, *args, **kwargs):
        for func in self.functions:
            try:
                value = func(*args, **kwargs)
            except self.exceptions:
Severity: Minor
Found in src/pytest_benchmark/utils.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 f' ({scale:.2f})'.ljust(width)
Severity: Major
Found in src/pytest_benchmark/table.py - About 30 mins to fix

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

        def q3(self):
            rounds = self.rounds
            data = self.sorted_data
    
            # See: https://en.wikipedia.org/wiki/Quartile#Computing_methods
    Severity: Minor
    Found in src/pytest_benchmark/stats.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 benchmark has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def benchmark(request):
        bs = request.config._benchmarksession
    
        if bs.skip:
            pytest.skip('Benchmarks are skipped (--benchmark-skip was used).')
    Severity: Minor
    Found in src/pytest_benchmark/plugin.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 info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def info(self, text, newline=True, **kwargs):
            if self.level >= self.NORMAL:
                if not kwargs or kwargs == {'bold': True}:
                    kwargs['purple'] = True
                if newline:
    Severity: Minor
    Found in src/pytest_benchmark/logger.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 q1 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def q1(self):
            rounds = self.rounds
            data = self.sorted_data
    
            # See: https://en.wikipedia.org/wiki/Quartile#Computing_methods
    Severity: Minor
    Found in src/pytest_benchmark/stats.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