fuzeman/byte

View on GitHub
byte/queries/where/query.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function __construct_expression has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def __construct_expression(self, expressions, op, left, right):
        if op in ['eq', '=', '==']:
            return ProxyEqual(left, right)

        if op in ['ne', '!=']:
Severity: Minor
Found in byte/queries/where/query.py - About 1 hr 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 __parse_string_parts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def __parse_string_parts(self, parts, offset=0, parameters=None):
        if (len(parts) - 1) % 2 > 0:
            raise ValueError('Incorrect number of expression parts')

        if parts[0] == '(' and parts[-1] == ')':
Severity: Minor
Found in byte/queries/where/query.py - About 1 hr 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_string_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __resolve_string_value(self, value, offset=0, parameters=None):
        if isinstance(value, BaseExpression):
            return offset, value

        if isinstance(value, list):
Severity: Minor
Found in byte/queries/where/query.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 __parse_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __parse_string(self, value, *parameters):
        if not value:
            return []

        if len(parameters) == 1 and type(parameters[0]) is tuple:
Severity: Minor
Found in byte/queries/where/query.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 offset, int(value)
Severity: Major
Found in byte/queries/where/query.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return ProxyOr(left, right)
    Severity: Major
    Found in byte/queries/where/query.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return offset, self.model.Internal.properties_by_name[value]
      Severity: Major
      Found in byte/queries/where/query.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return offset, value[1:-1]
        Severity: Major
        Found in byte/queries/where/query.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return ProxyGreaterThan(left, right)
          Severity: Major
          Found in byte/queries/where/query.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return ProxyGreaterThanOrEqual(left, right)
            Severity: Major
            Found in byte/queries/where/query.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return None
              Severity: Major
              Found in byte/queries/where/query.py - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status