airbnb/caravel

View on GitHub
superset-frontend/src/pages/QueryHistoryList/index.tsx

Summary

Maintainability
F
3 days
Test Coverage

File index.tsx has 429 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/QueryHistoryList/index.tsx - About 6 hrs to fix

    Function QueryList has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    function QueryList({ addDangerToast }: QueryListProps) {
      const {
        state: { loading, resourceCount: queryCount, resourceCollection: queries },
        fetchData,
      } = useListViewResource<QueryObject>(
    Severity: Minor
    Found in superset-frontend/src/pages/QueryHistoryList/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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

              if (names.length) {
                return (
                  <StyledTableLabel>
                    <span>{main}</span>
                    <Popover
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 1 other location - About 5 hrs to fix
    superset-frontend/src/pages/SavedQueryList/index.tsx on lines 324..344

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 153.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      const handleQueryPreview = useCallback(
        (id: number) => {
          SupersetClient.get({
            endpoint: `/api/v1/query/${id}`,
          }).then(
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 1 other location - About 3 hrs to fix
    superset-frontend/src/pages/SavedQueryList/index.tsx on lines 164..180

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 108.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          {
            Header: t('Database'),
            key: 'database',
            id: 'database',
            input: 'select',
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 1 other location - About 2 hrs to fix
    superset-frontend/src/pages/SavedQueryList/index.tsx on lines 452..472

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          {
            Header: t('User'),
            key: 'user',
            id: 'user',
            input: 'select',
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 2 other locations - About 1 hr to fix
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 382..399
    superset-frontend/src/pages/SavedQueryList/index.tsx on lines 473..490

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 73.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          {
            Header: t('State'),
            key: 'state',
            id: 'status',
            input: 'select',
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 2 other locations - About 1 hr to fix
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 400..417
    superset-frontend/src/pages/SavedQueryList/index.tsx on lines 473..490

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 73.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

              } else if (status === QueryState.TimedOut) {
                statusConfig.name = (
                  <Icons.Offline iconColor={theme.colors.grayscale.light1} />
                );
                statusConfig.label = t('Offline');
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 3 other locations - About 1 hr to fix
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 160..197
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 179..197
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 189..197

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

              } else if (
                status === QueryState.Scheduled ||
                status === QueryState.Pending
              ) {
                statusConfig.name = (
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 3 other locations - About 1 hr to fix
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 160..197
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 179..197
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 184..197

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

              if (status === QueryState.Success) {
                statusConfig.name = (
                  <Icons.Check iconColor={theme.colors.success.base} />
                );
                statusConfig.label = t('Success');
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 3 other locations - About 1 hr to fix
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 179..197
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 184..197
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 189..197

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

              } else if (status === QueryState.Running) {
                statusConfig.name = (
                  <Icons.Running iconColor={theme.colors.primary.base} />
                );
                statusConfig.label = t('Running');
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 3 other locations - About 1 hr to fix
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 160..197
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 184..197
    superset-frontend/src/pages/QueryHistoryList/index.tsx on lines 189..197

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    const TimerLabel = styled(Label)`
      text-align: left;
      font-family: ${({ theme }) => theme.typography.families.monospace};
    `;
    Severity: Major
    Found in superset-frontend/src/pages/QueryHistoryList/index.tsx and 7 other locations - About 35 mins to fix
    superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx on lines 66..69
    superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx on lines 71..74
    superset-frontend/src/SqlLab/components/TemplateParamsEditor/index.tsx on lines 31..35
    superset-frontend/src/components/InfoTooltip/index.tsx on lines 48..53
    superset-frontend/src/components/Switch/index.tsx on lines 23..27
    superset-frontend/src/components/Timer/index.tsx on lines 32..35
    superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx on lines 239..254

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status