grappa-py/grappa

View on GitHub

Showing 31 of 45 total issues

Avoid too many return statements within this function.
Open

                return True
Severity: Major
Found in grappa/operators/empty.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return True, 'property {0!r} found'.format(name)
    Severity: Major
    Found in grappa/operators/property.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return False, 'item {0!r} not found'.format(expected)
      Severity: Major
      Found in grappa/operators/contain.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return True
        Severity: Major
        Found in grappa/operators/empty.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return False
          Severity: Major
          Found in grappa/operators/empty.py - About 30 mins to fix

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

                def run(self, error):
                    # Assertion expression value
                    subject = self.normalize(
                        self.from_operator('subject', self.ctx.subject), use_raw=False)
            
            
            Severity: Minor
            Found in grappa/reporters/assertion.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 resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def resolve(self, name):
                    # Check if should stop the call chain
                    if self.ctx.stop_chain:
                        raise RuntimeError(
                            'grappa: test operator "{}" does not allow '
            Severity: Minor
            Found in grappa/resolver.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 match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def match(self, cls, *methods):
                    if len(methods) == 0:
                        return False, ['methods to implement cannot be empty']
            
                    def validate(reasons, method):
            Severity: Minor
            Found in grappa/operators/implements.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 after_success has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def after_success(self, obj, *keys):
                    if not self.ctx.negate:
                        self.ctx.subject = [obj[x] for x in obj if x in keys]
            
                    if len(keys) == 1 and len(self.ctx.subject):
            Severity: Minor
            Found in grappa/operators/keys.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 any has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def any(self, *tests):
                    """
                    Composes multiple tests and executes them, in series, once a
                    subject is received.
            
            
            Severity: Minor
            Found in grappa/test.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 match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def match(self, value, expected):
                    # Custom expectations yielded values
                    self.value = type(value).__name__
                    self.expected = expected
            
            
            Severity: Minor
            Found in grappa/operators/type.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