airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function parseResponse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default async function parseResponse<T extends ParseMethod = 'json'>(
  apiPromise: Promise<Response>,
  parseMethod?: T,
) {
  type ReturnType = T extends 'raw' | null

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

export default function buildQueryObject<T extends QueryFormData>(
  formData: T,
  queryFields?: QueryFieldAliases,
): QueryObject {
  const {

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

function ExecutionLog({
  addDangerToast,
  addSuccessToast,
  isReportEnabled,
}: ExecutionLogProps) {
Severity: Minor
Found in superset-frontend/src/pages/ExecutionLogList/index.tsx - 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 push has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          push(record) {
            const x = record[attr];
            if (['min', 'max'].includes(mode)) {
              const coercedValue = Number(x);
              if (Number.isNaN(coercedValue)) {

    Function getTooltipHtml has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function getTooltipHtml(d) {
        let html;
    
        if (d.sourceLinks) {
          // is node
    Severity: Minor
    Found in superset-frontend/plugins/legacy-plugin-chart-sankey/src/Sankey.js - About 1 hr to fix

      Function actions.CLONE_QUERY_TO_NEW_TAB has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          [actions.CLONE_QUERY_TO_NEW_TAB]() {
            const queryEditor = state.queryEditors.find(
              qe => qe.id === state.tabHistory[state.tabHistory.length - 1],
            );
            const progenitor = {
      Severity: Minor
      Found in superset-frontend/src/SqlLab/reducers/sqlLab.js - About 1 hr to fix

        Function actions.SET_ACTIVE_QUERY_EDITOR has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            [actions.SET_ACTIVE_QUERY_EDITOR]() {
              const qeIds = state.queryEditors.map(qe => qe.id);
              if (
                qeIds.indexOf(action.queryEditor?.id) > -1 &&
                state.tabHistory[state.tabHistory.length - 1] !== action.queryEditor.id
        Severity: Minor
        Found in superset-frontend/src/SqlLab/reducers/sqlLab.js - About 1 hr to fix

          Function saveModalReducer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function saveModalReducer(state = {}, action) {
            const actionHandlers = {
              [actions.SET_SAVE_CHART_MODAL_VISIBILITY]() {
                return { ...state, isVisible: action.isVisible };
              },
          Severity: Minor
          Found in superset-frontend/src/explore/reducers/saveModalReducer.js - About 1 hr to fix

            Function getDerivedStateFromProps has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static getDerivedStateFromProps(nextProps, state) {
                const { hasError, editorMode, markdownSource, undoLength, redoLength } =
                  state;
                const {
                  component: nextComponent,

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

                constructor() {
                  super({
                    buildQuery,
                    controlPanel,
                    loadChart: () => import('./EchartsSunburst'),

                Function extractShowValueIndexes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function extractShowValueIndexes(
                  series: SeriesOption[],
                  opts: {
                    stack: StackType;
                    onlyTotal?: boolean;
                Severity: Minor
                Found in superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts - About 1 hr to fix

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

                  export default function transformProps(chartProps: ChartProps) {
                    const { formData, queriesData, width, height } =
                      chartProps as EventFlowChartProps;
                    const { allColumnsX, entity, minLeafNodeEventCount } = formData;
                    const { data } = queriesData[0];

                    Function sortAndFilterSeries has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function sortAndFilterSeries(
                      rows: DataRecord[],
                      xAxis: string,
                      extraMetricLabels: any[],
                      sortSeriesType?: SortSeriesType,
                    Severity: Minor
                    Found in superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts - About 1 hr to fix

                      Function getLabelContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const getLabelContent = () => {
                          const shouldShowTooltip =
                            (!isDragging &&
                              typeof label === 'string' &&
                              tooltipTitle &&

                        Function mergeFilterBoxToFormData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const mergeFilterBoxToFormData = (
                          exploreFormData: QueryFormData,
                          dashboardFormData: JsonObject,
                        ) => {
                          const dateColumns = {

                          Function ButtonGroup has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function ButtonGroup(props: ButtonGroupProps) {
                            const { className, children } = props;
                            return (
                              <div
                                role="group"
                          Severity: Minor
                          Found in superset-frontend/src/components/ButtonGroup/index.tsx - About 1 hr to fix

                            Function renderModal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const renderModal = async (overrideState: Record<string, any> = {}) => {
                              const DrillDetailModalWrapper = () => {
                                const [showModal, setShowModal] = useState(false);
                                return (
                                  <>

                              Function handleScroll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export default function handleScroll(scroll: string) {
                                const setupScroll =
                                  scroll === 'SCROLL_TOP' &&
                                  !scrollTopDashboardInterval &&
                                  document.documentElement.scrollTop !== 0;

                                Function findTabsWithChartsInScopeHelper has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const findTabsWithChartsInScopeHelper = (
                                  dashboardLayout: DashboardLayout,
                                  chartsInScope: number[],
                                  componentId: string,
                                  tabIds: string[],
                                Severity: Minor
                                Found in superset-frontend/src/dashboard/components/nativeFilters/utils.ts - About 1 hr to fix

                                  Function confirmOverwriteField has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    const confirmOverwriteField = () => {
                                      if (!alreadyExists.length) return null;
                                  
                                      return (
                                        <>
                                  Severity: Minor
                                  Found in superset-frontend/src/features/databases/DatabaseModal/index.tsx - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language