airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function useDatasetMetadataBar has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export const useDatasetMetadataBar = ({
  dataset: datasetProps,
  datasetId,
}: UseDatasetMetadataBarProps) => {
  const theme = useTheme();

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

function AnnotationLayersList({
  addDangerToast,
  addSuccessToast,
  user,
}: AnnotationLayersListProps) {
Severity: Minor
Found in superset-frontend/src/pages/AnnotationLayerList/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 parseErrorJson has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export function parseErrorJson(responseJson: JsonObject): ClientErrorObject {
  let error = { ...responseJson };
  // Backwards compatibility for old error renderers with the new error object
  if (error.errors && error.errors.length > 0) {
    error.error = error.description = error.errors[0].message;

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

    [actions.REFRESH_QUERIES]() {
      let newQueries = { ...state.queries };
      // Fetch the updates to the queries present in the store.
      let change = false;
      let { queriesLastUpdate } = state;
Severity: Major
Found in superset-frontend/src/SqlLab/reducers/sqlLab.js - About 2 hrs to fix

    Function overwriteDashboard has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      overwriteDashboard() {
        const {
          dashboardTitle,
          layout: positions,
          colorScheme,
    Severity: Major
    Found in superset-frontend/src/dashboard/components/Header/index.jsx - About 2 hrs to fix

      Function createDeckGLComponent has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function createDeckGLComponent(
        getLayer: getLayerType<unknown>,
        getPoints: getPointsType,
      ) {
        // Higher order component
      Severity: Major
      Found in superset-frontend/plugins/legacy-preset-chart-deckgl/src/factory.tsx - About 2 hrs to fix

        Function promises has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              const promises = currentTimeRangeFilters.map(filter => {
                const nonCustomNorInheritShifts =
                  shiftsArray.filter(
                    (shift: string) => shift !== 'custom' && shift !== 'inherit',
                  ) || [];

          Function ViewQueryModalFooter has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const ViewQueryModalFooter: FC<ViewQueryModalFooterProps> = (props: {
            closeModal: () => void;
            changeDatasource: () => void;
            datasource: SimpleDataSource;
          }) => {

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

              render() {
                return (
                  <ModalTrigger
                    ref={this.modal}
                    triggerNode={this.props.triggerNode}
            Severity: Major
            Found in superset-frontend/src/dashboard/components/SaveModal.tsx - About 2 hrs to fix

              File mysql.py has 253 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/db_engine_specs/mysql.py - About 2 hrs to fix

                File lib.py has 253 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/db_engine_specs/lib.py - About 2 hrs to fix

                  File controlPanel.tsx has 253 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 exploreUtils.test.jsx has 252 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/explore/exploreUtils/exploreUtils.test.jsx - About 2 hrs to fix

                      File transformProps.ts has 252 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

                        Function updateColumns has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          updateColumns(cols) {
                            // cols: Array<{column_name: string; is_dttm: boolean; type: string;}>
                            const { databaseColumns } = this.state;
                            const databaseColumnNames = cols.map(col => col.column_name);
                            const currentCols = databaseColumns.reduce(
                        Severity: Major
                        Found in superset-frontend/src/components/Datasource/DatasourceEditor.jsx - About 2 hrs to fix

                          Function startPeriodicRender has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            startPeriodicRender(interval) {
                              let intervalMessage;
                          
                              if (interval) {
                                const { dashboardInfo } = this.props;
                          Severity: Major
                          Found in superset-frontend/src/dashboard/components/Header/index.jsx - About 2 hrs to fix

                            Function transformedData has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                (data_point, index) => {
                                  const name = groupbyLabels
                                    .map(column => `${verboseMap[column] || column}: ${data_point[column]}`)
                                    .join(', ');
                                  columnsLabelMap.set(

                              Function DeckGLGeoJson has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const DeckGLGeoJson = (props: DeckGLGeoJsonProps) => {
                                const containerRef = useRef<DeckGLContainerHandle>();
                                const setTooltip = useCallback((tooltip: TooltipProps['tooltip']) => {
                                  const { current } = containerRef;
                                  if (current) {

                                Function Control has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export default function Control(props: ControlProps) {
                                  const {
                                    actions: { setControlValue },
                                    name,
                                    type,
                                Severity: Major
                                Found in superset-frontend/src/explore/components/Control.tsx - About 2 hrs to fix

                                  Function useNativeFilters has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const useNativeFilters = () => {
                                    const [isInitialized, setIsInitialized] = useState(false);
                                    const canEdit = useSelector<RootState, boolean>(
                                      ({ dashboardInfo }) => dashboardInfo.dash_edit_perm,
                                    );
                                  Severity: Major
                                  Found in superset-frontend/src/dashboard/components/DashboardBuilder/state.ts - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language