airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function getSimpleSQLExpression has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getSimpleSQLExpression = (subject, operator, comparator) => {
  const isMulti =
    [...MULTI_OPERATORS]
      .map(op => OPERATOR_ENUM_TO_OPERATOR_TYPE[op].operation)
      .indexOf(operator) >= 0;
Severity: Minor
Found in superset-frontend/src/explore/exploreUtils/index.js - About 1 hr to fix

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

      render() {
        const { theme } = this.props;
        return (
          <div className="metrics-select" data-test="adhoc-filter-control">
            <HeaderContainer>

      Function fetchQueryResults has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function fetchQueryResults(query, displayLimit, timeoutInMs) {
        return function (dispatch, getState) {
          const { SQLLAB_QUERY_RESULT_TIMEOUT } = getState().common?.conf ?? {};
          dispatch(requestQueryResults(query));
      
      
      Severity: Minor
      Found in superset-frontend/src/SqlLab/actions/sqlLab.js - About 1 hr to fix

        Function renderSpatialTab has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          renderSpatialTab() {
            const { datasource } = this.state;
            const { spatials, all_cols: allCols } = datasource;
            return (
              <Tabs.TabPane
        Severity: Minor
        Found in superset-frontend/src/components/Datasource/DatasourceEditor.jsx - About 1 hr to fix

          Function renderSparklineCell has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              const renderSparklineCell = (valueField, column, entries) => {
                let sparkData;
                if (column.timeRatio) {
                  // Period ratio sparkline
                  sparkData = [];
          Severity: Minor
          Found in superset-frontend/src/visualizations/TimeTable/TimeTable.jsx - About 1 hr to fix

            Function processHTML has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function processHTML(proxyResponse, response) {
              let body = Buffer.from([]);
              let originalResponse = proxyResponse;
              let uncompress;
              const responseEncoding = originalResponse.headers['content-encoding'];
            Severity: Minor
            Found in superset-frontend/webpack.proxy-config.js - About 1 hr to fix

              Function generatePageItems has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function generatePageItems(
                total: number,
                current: number,
                width: number,
              ) {

                Function getLayer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function getLayer(
                  formData: QueryFormData,
                  payload: JsonObject,
                  onAddFilter: () => void,
                  setTooltip: (tooltip: TooltipProps['tooltip']) => void,

                  Function filteredMetrics has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const filteredMetrics = useMemo(() => {
                      if (!searchKeyword) {
                        return allowedMetrics ?? [];
                      }
                      return matchSorter(allowedMetrics, searchKeyword, {
                  Severity: Minor
                  Found in superset-frontend/src/explore/components/DatasourcePanel/index.tsx - About 1 hr to fix

                    Function useChartEditModal has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const useChartEditModal = (
                      setCharts: (charts: Array<Chart>) => void,
                      charts: Array<Chart>,
                    ) => {
                      const [sliceCurrentlyEditing, setSliceCurrentlyEditing] =
                    Severity: Minor
                    Found in superset-frontend/src/views/CRUD/hooks.ts - About 1 hr to fix

                      Function copyTextToClipboard has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                new Promise<void>((resolve, reject) => {
                                  const selection: Selection | null = document.getSelection();
                                  if (selection) {
                                    selection.removeAllRanges();
                                    const range = document.createRange();
                      Severity: Minor
                      Found in superset-frontend/src/utils/copy.ts - About 1 hr to fix

                        Function handleOnChange has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              (values: any, options: any) => {
                                // intercept onChange call to handle the select all case
                                // if the "select all" option is selected, we want to send all options to the onChange,
                                // otherwise we want to remove
                                let newValues = values;
                        Severity: Minor
                        Found in superset-frontend/src/components/Select/Select.tsx - About 1 hr to fix

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

                            render() {
                              return (
                                <>
                                  <CrudButtonWrapper>
                                    {this.props.allowAddItem && (
                          Severity: Minor
                          Found in superset-frontend/src/components/Datasource/CollectionTable.tsx - About 1 hr to fix

                            Function Icon has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const Icon = (props: IconProps) => {
                              const { fileName, ...iconProps } = props;
                              const [, setLoaded] = useState(false);
                              const ImportedSVG = useRef<FC<SVGProps<SVGSVGElement>>>();
                              const name = fileName.replace('_', '-');
                            Severity: Minor
                            Found in superset-frontend/src/components/Icons/Icon.tsx - About 1 hr to fix

                              Function onSave has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                const onSave = () => {
                                  if (isEditMode) {
                                    // Edit
                                    if (currentCssTemplate?.id) {
                                      const update_id = currentCssTemplate.id;
                              Severity: Minor
                              Found in superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx - About 1 hr to fix

                                Function setInScopeStatusOfFilters has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  async (dispatch: Dispatch, getState: () => any) => {
                                    const filters = getState().nativeFilters?.filters;
                                    const filtersWithScopes = filterScopes.map(scope => ({
                                      ...filters[scope.filterId],
                                      chartsInScope: scope.chartsInScope,
                                Severity: Minor
                                Found in superset-frontend/src/dashboard/actions/nativeFilters.ts - About 1 hr to fix

                                  Function validateForm has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const validateForm = async (
                                    form: FormInstance<NativeFiltersForm>,
                                    currentFilterId: string,
                                    setCurrentFilterId: Function,
                                  ) => {

                                    Function disableEmbedded has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      const disableEmbedded = useCallback(() => {
                                        Modal.confirm({
                                          title: t('Disable embedding?'),
                                          content: t('This will remove your current embed configuration.'),
                                          okType: 'danger',
                                    Severity: Minor
                                    Found in superset-frontend/src/dashboard/components/EmbeddedModal/index.tsx - About 1 hr to fix

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

                                        constructor({
                                          baseUrl = DEFAULT_BASE_URL,
                                          host,
                                          protocol,
                                          headers = {},

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

                                          renderValueConfiguration() {
                                            const { annotationType, sourceType, value } = this.state;
                                            let label = '';
                                            let description = '';
                                            if (requiresQuery(sourceType)) {

                                        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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language