douwevandermeij/fractal-specifications

View on GitHub

Showing 37 of 37 total issues

DSLTransformer has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class DSLTransformer(Transformer):
    def expression(self, items):
        return items[0]

    def and_expression(self, items):
Severity: Minor
Found in fractal_specifications/generic/dsl_parser.py - About 2 hrs to fix

    Function build has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def build(specification: Optional[Specification] = None) -> Optional[Collection]:
            if specification is None:
                return None
            elif isinstance(specification, EmptySpecification):
                return None
    Severity: Minor
    Found in fractal_specifications/contrib/google_firestore/specifications.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 build has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def build(specification: Optional[Specification] = None) -> Optional[Collection]:
            if specification is None:
                return None
            elif isinstance(specification, EmptySpecification):
                return None
    Severity: Minor
    Found in fractal_specifications/contrib/mongo/specifications.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 build has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def build(specification: Optional[Specification] = None) -> Optional[dict]:
            if specification is None:
                return None
            elif isinstance(specification, EmptySpecification):
                return None
    Severity: Minor
    Found in fractal_specifications/contrib/elasticsearch/specifications.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 dump_dsl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def dump_dsl(self) -> Optional[str]:
            from fractal_specifications.generic import collections, operators
    
            if isinstance(self, operators.NotSpecification):
                child = self.specification.dump_dsl()
    Severity: Minor
    Found in fractal_specifications/generic/specification.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 build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def build(
            cls,
            specification: Optional[Specification] = None,
            *,
            return_mask=False,
    Severity: Minor
    Found in fractal_specifications/contrib/pandas/specifications.py - About 55 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 comparison_expression has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def comparison_expression(self, items):
            from fractal_specifications.generic.specification import Specification
    
            if issubclass(type(items[0]), Specification):
                return items[0]
    Severity: Minor
    Found in fractal_specifications/generic/dsl_parser.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 GreaterThanSpecification(field_name, value)
    Severity: Major
    Found in fractal_specifications/generic/dsl_parser.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return {specification.field: {"$gt": specification.value}}
      Severity: Major
      Found in fractal_specifications/contrib/mongo/specifications.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return {specification.field: {"$eq": specification.value}}
        Severity: Major
        Found in fractal_specifications/contrib/mongo/specifications.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return specification.field, ">=", specification.value
          Severity: Major
          Found in fractal_specifications/contrib/google_firestore/specifications.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return LessThanEqualSpecification(field_name, value)
            Severity: Major
            Found in fractal_specifications/generic/dsl_parser.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return {
              Severity: Major
              Found in fractal_specifications/contrib/elasticsearch/specifications.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return specification.field, "in", specification.value
                Severity: Major
                Found in fractal_specifications/contrib/google_firestore/specifications.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return {"match": {"%s.keyword" % specification.field: specification.value}}
                  Severity: Major
                  Found in fractal_specifications/contrib/elasticsearch/specifications.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return {specification.field: specification.value}
                    Severity: Major
                    Found in fractal_specifications/contrib/sqlalchemy/specifications.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return {
                      Severity: Major
                      Found in fractal_specifications/contrib/mongo/specifications.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return specification.field, "<", specification.value
                        Severity: Major
                        Found in fractal_specifications/contrib/google_firestore/specifications.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return {
                          Severity: Major
                          Found in fractal_specifications/contrib/elasticsearch/specifications.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return {specification.field: {"$lte": specification.value}}
                            Severity: Major
                            Found in fractal_specifications/contrib/mongo/specifications.py - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language