grappa-py/http

View on GitHub

Showing 4 of 14 total issues

Function compare has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def compare(self, url, query, strict=False):
        if isinstance(query, str):
            query = parse_qs(query)

        if not isinstance(query, dict):
Severity: Minor
Found in grappa_http/operators/url_parts.py - About 2 hrs 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 _match has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _match(self, res, header, value=None, includes=False):
        # Set subject headers
        self.subject = res.headers.get(header)

        if not header:
Severity: Minor
Found in grappa_http/operators/header.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

Avoid too many return statements within this function.
Open

        return True, None
Severity: Major
Found in grappa_http/operators/header.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return expected in url, ['"{}" cannot be found in URL: {}'.format(
    Severity: Major
    Found in grappa_http/operators/url.py - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language