airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function histogram has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def histogram(
Severity: Minor
Found in superset/utils/pandas_postprocessing/histogram.py - About 45 mins to fix

    Function execute_sql_statement has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def execute_sql_statement(  # pylint: disable=too-many-statements, too-many-locals
    Severity: Minor
    Found in superset/sql_lab.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if serialized_payload_size > max_bytes:
                              logger.info("Result size exceeds the allowed limit.")
                              raise SupersetErrorException(
                                  SupersetError(
                                      message=f"Result size ({serialized_payload_size / BYTES_IN_MB:.2f} MB) exceeds the allowed limit of {sql_lab_payload_max_mb} MB.",
      Severity: Major
      Found in superset/sql_lab.py - About 45 mins to fix

        Function _check_cte_is_select has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _check_cte_is_select(self, oxide_parse: list[dict[str, Any]]) -> bool:
                """
                Check if a oxide parsed CTE contains only SELECT statements
        
                :param oxide_parse: parsed CTE
        Severity: Minor
        Found in superset/sql_parse.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 deeply nested control flow statements.
        Open

                            if isinstance(filtr["val"], list):
                                if isinstance(existing_filters[filter_key], list):
                                    # Add filters for unequal lists
                                    # order doesn't matter
                                    if set(existing_filters[filter_key]) != set(filtr["val"]):
        Severity: Major
        Found in superset/utils/core.py - About 45 mins to fix

          Function cache_warmup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def cache_warmup(
              strategy_name: str, *args: Any, **kwargs: Any
          ) -> Union[dict[str, list[str]], str]:
              """
              Warm up cache.
          Severity: Minor
          Found in superset/tasks/cache.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

          Function estimate_query_cost has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def estimate_query_cost(  # pylint: disable=too-many-arguments
          Severity: Minor
          Found in superset/db_engine_specs/bigquery.py - About 45 mins to fix

            Function latest_sub_partition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def latest_sub_partition(
                    cls,
                    database: Database,
                    table: Table,
                    **kwargs: Any,
            Severity: Minor
            Found in superset/db_engine_specs/presto.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 deeply nested control flow statements.
            Open

                                    if column_type is None:
                                        column_type = types.String()
                                        logger.info(
                                            "Did not recognize type %s of column %s",
                                            field_info[1],
            Severity: Major
            Found in superset/db_engine_specs/presto.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if field_info[1] == "array" or field_info[1] == "row":
                                          stack.append((field_info[0], field_info[1]))
                                          full_parent_path = cls._get_full_name(stack)
                                          result.append(
                                              cls._create_column_info(full_parent_path, column_type)
              Severity: Major
              Found in superset/db_engine_specs/presto.py - About 45 mins to fix

                Function update_impersonation_config has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def update_impersonation_config(  # pylint: disable=too-many-arguments
                Severity: Minor
                Found in superset/db_engine_specs/trino.py - About 45 mins to fix

                  Function update_impersonation_config has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def update_impersonation_config(  # pylint: disable=too-many-arguments
                  Severity: Minor
                  Found in superset/db_engine_specs/base.py - About 45 mins to fix

                    Function normalize_df has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def normalize_df(self, df: pd.DataFrame, query_object: QueryObject) -> pd.DataFrame:
                            # todo: should support "python_date_format" and "get_column" in each datasource
                            def _get_timestamp_format(
                                source: BaseDatasource, column: str | None
                            ) -> str | None:
                    Severity: Minor
                    Found in superset/common/query_context_processor.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

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

                        def __init__(
                    Severity: Minor
                    Found in superset/sqllab/query_render.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if post_processing.get("operation") == "pivot":
                                                  post_processing["options"]["index"] = [granularity]
                      
                                  # If no temporal x-axis, then get the default temporal filter
                                  if not filter_to_remove:
                      Severity: Major
                      Found in superset/common/query_context_factory.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if not single_field:
                                                    continue
                                                # split on whitespace to get field name and data type
                                                field_info = cls._split_data_type(single_field, r"\s")
                        Severity: Major
                        Found in superset/db_engine_specs/presto.py - About 45 mins to fix

                          Function get_prequeries has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def get_prequeries(
                          Severity: Minor
                          Found in superset/db_engine_specs/base.py - About 45 mins to fix

                            Function get_dbapi_exception_mapping has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def get_dbapi_exception_mapping(cls) -> dict[type[Exception], type[Exception]]:
                                    # pylint: disable=import-outside-toplevel
                                    from requests import exceptions as requests_exceptions
                                    from trino import exceptions as trino_exceptions
                            
                            
                            Severity: Minor
                            Found in superset/db_engine_specs/trino.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

                            Function update_impersonation_config has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def update_impersonation_config(  # pylint: disable=too-many-arguments
                            Severity: Minor
                            Found in superset/db_engine_specs/hive.py - About 45 mins to fix

                              Function _get_fields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def _get_fields(cls, cols: list[ResultSetColumnType]) -> list[ColumnClause]:
                                      """
                                      Format column clauses where names are in quotes and labels are specified
                                      :param cols: columns
                                      :return: column clauses
                              Severity: Minor
                              Found in superset/db_engine_specs/presto.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

                              Severity
                              Category
                              Status
                              Source
                              Language