airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function DynamicEditableTitle has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  ({
    title,
    placeholder,
    onSave,
    canEdit,
Severity: Minor
Found in superset-frontend/src/components/DynamicEditableTitle/index.tsx - About 3 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 createMultiFormatter has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export default function createMultiFormatter({
  id,
  label,
  description,
  formats = {},

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 handleComponentDrop has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function handleComponentDrop(dropResult) {
  return (dispatch, getState) => {
    const overflowsParent = dropOverflowsParent(
      dropResult,
      getState().dashboardLayout.present,
Severity: Major
Found in superset-frontend/src/dashboard/actions/dashboardLayout.js - About 3 hrs to fix

    Function extractSeries has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function extractSeries(
      data: DataRecord[],
      opts: {
        fillNeighborValue?: number;
        xAxis?: string;
    Severity: Major
    Found in superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts - About 3 hrs to fix

      Function renderControls has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const renderControls = () => {
          let keyLink;
          const KEYS_FOR_TABLE_TEXT = t('Keys for table');
          if (tableData?.indexes?.length) {
            keyLink = (
      Severity: Major
      Found in superset-frontend/src/SqlLab/components/TableElement/index.tsx - About 3 hrs to fix

        Function onFinish has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const onFinish = () => {
            const { title, slug, certifiedBy, certificationDetails } =
              form.getFieldsValue();
            let currentColorScheme = colorScheme;
            let currentJsonMetadata = jsonMetadata;
        Severity: Major
        Found in superset-frontend/src/dashboard/components/PropertiesModal/index.tsx - About 3 hrs to fix

          Function renderTimeComparisonDropdown has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const renderTimeComparisonDropdown = (): JSX.Element => {
              const allKey = comparisonColumns[0].key;
              const handleOnClick = (data: any) => {
                const { key } = data;
                // Toggle 'All' key selection
          Severity: Major
          Found in superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx - About 3 hrs to fix

            Function ControlWithVerification has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              return function ControlWithVerification(props: FullControlProps) {
                const {
                  hovered,
                  onChange: basicOnChange,
                  needAsyncVerification = false,

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

                render() {
                  const noQueryEditors = this.props.queryEditors?.length === 0;
                  const editors = this.props.queryEditors?.map(qe => (
                    <EditableTabs.TabPane
                      key={qe.id}
              Severity: Major
              Found in superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx - About 3 hrs to fix

                File MetricsControl.jsx has 293 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

                  File index.tsx has 293 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/components/Table/index.tsx - About 3 hrs to fix

                    File FilterControls.tsx has 293 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

                      File TimeTable.jsx has 292 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/visualizations/TimeTable/TimeTable.jsx - About 3 hrs to fix

                        File SavedQueryList.test.jsx has 292 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/pages/SavedQueryList/SavedQueryList.test.jsx - About 3 hrs to fix

                          Function Chord has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function Chord(element, props) {
                            const { data, width, height, numberFormat, colorScheme, sliceId } = props;
                          
                            element.innerHTML = '';
                          
                          
                          Severity: Major
                          Found in superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.js - About 3 hrs to fix

                            Query has 26 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Query(
                                SqlTablesMixin,
                                ExtraJSONMixin,
                                ExploreMixin,
                                Model,
                            Severity: Minor
                            Found in superset/models/sql_lab.py - About 3 hrs to fix

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

                                  def get_sqla_query(  # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements
                              Severity: Major
                              Found in superset/models/helpers.py - About 3 hrs to fix

                                BigQueryEngineSpec has 26 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class BigQueryEngineSpec(BaseEngineSpec):  # pylint: disable=too-many-public-methods
                                    """Engine spec for Google's BigQuery
                                
                                    As contributed by @mxmzdlv on issue #945"""
                                
                                
                                Severity: Minor
                                Found in superset/db_engine_specs/bigquery.py - About 3 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 componentDidMount has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      componentDidMount() {
                                        // merge post form data with GET search params
                                        // Hack: this data should be coming from getInitialState
                                        // but for some reason this data isn't being passed properly through
                                        // the reducer.
                                    Severity: Major
                                    Found in superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language