airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function replace has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def replace(source, target):
    bind = op.get_bind()
    session = db.Session(bind=bind)

    query = (

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

def get_type_generator(  # pylint: disable=too-many-return-statements,too-many-branches
    sqltype: sqlalchemy.sql.sqltypes,
) -> Callable[[], Any]:
    if isinstance(sqltype, sqlalchemy.dialects.mysql.types.TINYINT):
        return lambda: random.choice([0, 1])
Severity: Minor
Found in superset/utils/mock_data.py - About 2 hrs 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 port_translate_filter_func has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def port_translate_filter_func(
    col: Column, operator: FilterOperator, values: list[Any]
) -> Any:
    """
    Convert a passed in column, FilterOperator
Severity: Minor
Found in superset/advanced_data_type/plugins/internet_port.py - About 2 hrs 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_timestamp_expr has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def get_timestamp_expr(
        cls,
        col: ColumnClause,
        pdf: str | None,
        time_grain: str | None,
Severity: Minor
Found in superset/db_engine_specs/base.py - About 2 hrs 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_viz_annotation_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def get_viz_annotation_data(
        annotation_layer: dict[str, Any], force: bool
    ) -> dict[str, Any]:
        # pylint: disable=import-outside-toplevel
        from superset.commands.chart.data.get_data_command import ChartDataCommand
Severity: Minor
Found in superset/common/query_context_processor.py - About 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self) -> None:
        exceptions: list[ValidationError] = []
        dashboard_ids = self._properties.get("dashboards")
        owner_ids: Optional[list[int]] = self._properties.get("owners")
        tag_ids: Optional[list[int]] = self._properties.get("tags")
Severity: Minor
Found in superset/commands/chart/update.py - About 2 hrs 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 transformProps has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export default function transformProps(
  chartProps: EchartsPieChartProps,
): PieChartTransformedProps {
  const {
    formData,

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

export function useListViewResource<D extends object = any>(
  resource: string,
  resourceLabel: string, // resourceLabel for translations
  handleErrorMsg: (errorMsg: string) => void,
  infoEnable = true,
Severity: Minor
Found in superset-frontend/src/views/CRUD/hooks.ts - About 2 hrs 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 EmptyState has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export default function EmptyState({
  tableName,
  tab,
  otherTabTitle,
}: EmptyStateProps) {
Severity: Minor
Found in superset-frontend/src/features/home/EmptyState.tsx - About 2 hrs 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 Welcome has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function Welcome({ user, addDangerToast }: WelcomeProps) {
  const canReadSavedQueries = userHasPermission(user, 'SavedQuery', 'can_read');
  const userid = user.userId;
  const id = userid!.toString(); // confident that user is not a guest user
  const params = rison.encode({ page_size: 6 });
Severity: Minor
Found in superset-frontend/src/pages/Home/index.tsx - About 2 hrs 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 naturalSort has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const naturalSort = (as, bs) => {
  // nulls first
  if (bs !== null && as === null) {
    return -1;
  }

    Function updateActive has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function updateActive() {
        const delay = d3.event.altKey ? 3000 : 300;
        legendWrap.datum(legendData(datum)).call(legend);
        const nArcSt = computeArcStates(datum);
        inTransition = true;
    Severity: Major
    Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js - About 2 hrs to fix

      Function constructor has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(props) {
          super(props);
          this.state = {
            datasource: {
              ...props.datasource,
      Severity: Major
      Found in superset-frontend/src/components/Datasource/DatasourceEditor.jsx - About 2 hrs to fix

        File post_processing.py has 260 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/charts/post_processing.py - About 2 hrs to fix

          Function HeaderWithRadioGroup has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function HeaderWithRadioGroup(props: HeaderWithRadioGroupProps) {
            const { headerTitle, groupTitle, groupOptions, value, onChange } = props;
            const theme = useTheme();
            const [popoverVisible, setPopoverVisible] = useState(false);
          
          

            File index.tsx has 259 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
            Severity: Minor
            Found in superset-frontend/src/dashboard/components/SliceHeader/index.tsx - About 2 hrs to fix

              Function render has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  const {
                    width,
                    height,
                    aggregatorName,
              Severity: Major
              Found in superset-frontend/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx - About 2 hrs to fix

                Function transformProps has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function transformProps(chartProps) {
                  const {
                    width,
                    height,
                    formData,

                  Function load_deck_dash has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  def load_deck_dash() -> None:  # pylint: disable=too-many-statements
                      print("Loading deck.gl dashboard")
                      slices = []
                      table = get_table_connector_registry()
                      tbl = db.session.query(table).filter_by(table_name="long_lat").first()
                  Severity: Major
                  Found in superset/examples/deck.py - About 2 hrs to fix

                    Function getBasicColorFormatter has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const getBasicColorFormatter = memoizeOne(function getBasicColorFormatter(
                        originalData: DataRecord[] | undefined,
                        originalColumns: DataColumnMeta[],
                        selectedColumns?: ConditionalFormattingConfig[],
                      ) {
                    Severity: Major
                    Found in superset-frontend/plugins/plugin-chart-table/src/transformProps.ts - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language