airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

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

    def validate_parameters(
        cls, properties: BasicPropertiesType
    ) -> list[SupersetError]:
        """
        Validates any number of parameters, for progressive validation.
Severity: Minor
Found in superset/db_engine_specs/base.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 convert_dttm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_dttm(
        cls, target_type: str, dttm: datetime, db_extra: Optional[dict[str, Any]] = None
    ) -> Optional[str]:
        db_extra = db_extra or {}

Severity: Minor
Found in superset/db_engine_specs/elasticsearch.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 get_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def get_data(self, df: pd.DataFrame) -> VizData:
        if df.empty:
            return None

        label_col = self.form_data.get("mapbox_label")
Severity: Minor
Found in superset/viz.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 query_obj has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def query_obj(self) -> QueryObjectDict:
        query_obj = super().query_obj()
        if len(query_obj["groupby"]) < len(self.form_data.get("groupby") or []) + len(
            self.form_data.get("columns") or []
        ):
Severity: Minor
Found in superset/viz.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/base.py - About 45 mins to fix

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

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

      Avoid deeply nested control flow statements.
      Open

                              for j, value in enumerate(values):
                                  data[i + j][name] = value
      
                              # skip newly unnested rows
                              i += unnested_rows[i]
      Severity: Major
      Found in superset/db_engine_specs/presto.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for _ in range(missing):
                                    data.insert(i + current_unnested_rows + 1, {})
                                    unnested_rows[i] += 1
        
                                # unnest array into rows
        Severity: Major
        Found in superset/db_engine_specs/presto.py - About 45 mins to fix

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

              def df_to_sql(
                  cls,
                  database: Database,
                  table: Table,
                  df: pd.DataFrame,
          Severity: Minor
          Found in superset/db_engine_specs/hive.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/presto.py - About 45 mins to fix

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

                def _get_url(
                    self,
                    user_friendly: bool = False,
                    result_format: Optional[ChartDataResultFormat] = None,
                    **kwargs: Any,
            Severity: Minor
            Found in superset/commands/report/execute.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_dataset_perm has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

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

                  def run(self) -> Optional[str]:
                      self.validate()
                      try:
                          datasource_id = self._cmd_params.datasource_id
                          chart_id = self._cmd_params.chart_id
              Severity: Minor
              Found in superset/commands/explore/form_data/update.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate(self) -> None:
                      exceptions = []
                      # Validate/populate model exists
                      self._model = TagDAO.find_by_id(self._model_id)
                      if not self._model:
              Severity: Minor
              Found in superset/commands/tag/update.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate(self) -> None:
                      # TODO(hughhh): check to make sure the server port is not localhost
                      # using the config.SSH_TUNNEL_MANAGER
              
                      exceptions: list[ValidationError] = []
              Severity: Minor
              Found in superset/commands/database/ssh_tunnel/create.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate(self) -> None:
                      exceptions: list[ValidationError] = []
                      owner_ids: Optional[list[int]] = self._properties.get("owners")
                      roles_ids: Optional[list[int]] = self._properties.get("roles")
                      slug: Optional[str] = self._properties.get("slug")
              Severity: Minor
              Found in superset/commands/dashboard/update.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 _delete_pvm_on_sqla_event has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

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

                    def data(self) -> Response:
                        """
                        Take a query context constructed in the client and return payload
                        data response for the given query
                        ---
                Severity: Minor
                Found in superset/charts/data/api.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 dataset:
                                            yield from ExportDatasetsCommand([dataset_id]).run()
                Severity: Major
                Found in superset/commands/dashboard/export.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if len(rls_filters) > 0:
                                          stringified_rls += (
                                              f"{str(datasource.id)}\t"
                                              + "\t".join([str(f) for f in rls_filters])
                                              + "\n"
                  Severity: Major
                  Found in superset/thumbnails/digest.py - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language