airbnb/caravel

View on GitHub
superset/common/query_object.py

Summary

Maintainability
D
1 day
Test Coverage

File query_object.py has 370 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
Severity: Minor
Found in superset/common/query_object.py - About 4 hrs to fix

    Function __init__ has 24 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(  # pylint: disable=too-many-locals, too-many-arguments
    Severity: Major
    Found in superset/common/query_object.py - About 3 hrs to fix

      Function cache_key has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def cache_key(self, **extra: Any) -> str:
              """
              The cache key is made out of the key/values from to_dict(), plus any
              other key/values in `extra`
              We remove datetime bounds that are hard values, and replace them with
      Severity: Minor
      Found in superset/common/query_object.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 __init__ has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def __init__(  # pylint: disable=too-many-locals, too-many-arguments
              self,
              *,
              annotation_layers: list[dict[str, Any]] | None = None,
              applied_time_extras: dict[str, str] | None = None,
      Severity: Minor
      Found in superset/common/query_object.py - About 1 hr to fix

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

            def _move_deprecated_extra_fields(self, kwargs: dict[str, Any]) -> None:
                # move deprecated extras fields to extras
                for field in DEPRECATED_EXTRAS_FIELDS:
                    if field.old_name in kwargs:
                        logger.warning(
        Severity: Minor
        Found in superset/common/query_object.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 _rename_deprecated_fields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def _rename_deprecated_fields(self, kwargs: dict[str, Any]) -> None:
                # rename deprecated fields
                for field in DEPRECATED_FIELDS:
                    if field.old_name in kwargs:
                        logger.warning(
        Severity: Minor
        Found in superset/common/query_object.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 _sanitize_filters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _sanitize_filters(self) -> None:
                for param in ("where", "having"):
                    clause = self.extras.get(param)
                    if clause:
                        try:
        Severity: Minor
        Found in superset/common/query_object.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

        There are no issues that match your filters.

        Category
        Status