airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function useDatasetsList has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useDatasetsList = (
  db:
    | (DatabaseObject & {
        owners: [number];
      })
Severity: Minor
Found in superset-frontend/src/features/datasets/hooks/useDatasetLists.ts - About 1 hr to fix

    Function onSave has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const onSave = async () => {
        // Create new Report
        const newReportValues: Partial<ReportObject> = {
          type: 'Report',
          active: true,
    Severity: Minor
    Found in superset-frontend/src/features/reports/ReportModal/index.tsx - About 1 hr to fix

      Function dataMaskReducer has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        (draft: DataMaskStateWithId, action: AnyDataMaskAction) => {
          const cleanState = {};
          switch (action.type) {
            case CLEAR_DATA_MASK_STATE:
              return cleanState;
      Severity: Minor
      Found in superset-frontend/src/dataMask/reducer.ts - About 1 hr to fix

        Function normalizeTimeColumn has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function normalizeTimeColumn(
          formData: QueryFormData,
          queryObject: QueryObject,
        ): QueryObject {
          // The formData should be "raw form_data" -- the snake_case version of formData rather than camelCase.

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

            renderSliceConfiguration() {
              const {
                annotationType,
                sourceType,
                value,

          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 render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              const {
                adhocMetric: propsAdhocMetric,
                savedMetric: propsSavedMetric,
                columns,

          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_docker_command has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_docker_command(
              build_preset: str,
              build_platforms: list[str],
              is_authenticated: bool,
              sha: str,
          Severity: Minor
          Found in scripts/build_docker.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 traverse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function traverse({
            currentNode = {},
            components = {},
            filterFields = [],
            selectedChartId,
          Severity: Minor
          Found in superset-frontend/src/dashboard/util/getFilterScopeNodesTree.js - 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 load_multiformat_time_series has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def load_multiformat_time_series(  # pylint: disable=too-many-locals
              only_metadata: bool = False, force: bool = False
          ) -> None:
              """Loading time series data from a zip file in the repo"""
              tbl_name = "multiformat_time_series"
          Severity: Minor
          Found in superset/examples/multiformat_time_series.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 _migrate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def _migrate(self) -> None:
                  if self.data.get("viz_type") != self.source_viz_type:
                      return
          
                  if "viz_type" in self.data:
          Severity: Minor
          Found in superset/migrations/shared/migrate_viz/base.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 upgrade has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def upgrade():
              bind = op.get_bind()
              session = db.Session(bind=bind)
              x_dateunit_in_since = DateRangeMigration.x_dateunit_in_since
              x_dateunit_in_until = DateRangeMigration.x_dateunit_in_until

          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 export_to_dict has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def export_to_dict(
                  self,
                  recursive: bool = True,
                  include_parent_ref: bool = False,
                  include_defaults: bool = False,
          Severity: Minor
          Found in superset/models/helpers.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 set_app_error_handlers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def set_app_error_handlers(app: Flask) -> None:
              """
              Set up error handlers for the Flask app
              Refer to SIP-40 and SIP-41 for more details on the error handling strategy
              """
          Severity: Minor
          Found in superset/views/error_handling.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 export_dashboards has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def export_dashboards(  # pylint: disable=too-many-locals
                  cls,
                  dashboard_ids: set[int],
              ) -> str:
                  copied_dashboards = []
          Severity: Minor
          Found in superset/models/dashboard.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 query_obj has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def query_obj(self) -> QueryObjectDict:  # pylint: disable=too-many-locals
                  """Building a query object"""
                  self.process_query_filters()
          
                  metrics = self.all_metrics or []
          Severity: Minor
          Found in superset/viz.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 handle_cursor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_cursor(cls, cursor: Cursor, query: Query) -> None:
                  """Updates progress information"""
                  if tracking_url := cls.get_tracking_url(cursor):
                      query.tracking_url = tracking_url
                      db.session.commit()
          Severity: Minor
          Found in superset/db_engine_specs/presto.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 get_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_data(self, df: pd.DataFrame) -> VizData:
                  if df.empty:
                      return None
          
                  data = super().get_data(df)
          Severity: Minor
          Found in superset/viz.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 validate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def validate(self) -> None:
                  exceptions: list[ValidationError] = []
                  database_id = self._properties["database"]
                  catalog = self._properties.get("catalog")
                  schema = self._properties.get("schema")
          Severity: Minor
          Found in superset/commands/dataset/create.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 join_offset_dfs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def join_offset_dfs(
                  self,
                  df: pd.DataFrame,
                  offset_dfs: dict[str, pd.DataFrame],
                  time_grain: str | None,
          Severity: Minor
          Found in superset/common/query_context_processor.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 validate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def validate(self) -> None:
                  exceptions = []
                  objects_to_tag = set(self._properties.get("objects_to_tag", []))
                  for obj_type, obj_id in objects_to_tag:
                      object_type = to_object_type(obj_type)
          Severity: Minor
          Found in superset/commands/tag/create.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

          Severity
          Category
          Status
          Source
          Language