airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function validateForm has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

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

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

export default function Select<VT extends string | number>({
  creatable,
  onSearch,
  dropdownMatchSelectWidth = false,
  minWidth = '100%',

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

    const rows = data.map((entry, i) => {
      const values = groups.map(
        (
          group,
          j, // group names

    Function applyYAxisBounds has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const applyYAxisBounds = () => {
          if (
            chart.yDomain &&
            Array.isArray(yAxisBounds) &&
            yAxisBounds.length === 2
    Severity: Minor
    Found in superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js - About 1 hr to fix

      Function valueCells has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const valueCells = visibleColKeys.map(colKey => {
            const flatColKey = flatKey(colKey);
            const agg = pivotData.getAggregator(rowKey, colKey);
            const aggValue = agg.value();
      
      

        Function positionAndPopulate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function positionAndPopulate(tip, d) {
              let t = '<table>';
              if (useRichTooltip) {
                const nodes = getAncestors(d);
                nodes.reverse().forEach(n => {

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

            constructor(props) {
              super(props);
              const suppressContextMenu = getChartMetadataRegistry().get(
                props.formData.viz_type ?? props.vizType,
              )?.suppressContextMenu;
          Severity: Minor
          Found in superset-frontend/src/components/Chart/ChartRenderer.jsx - About 1 hr to fix

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

              render() {
                const { showSelector } = this.state;
            
                return (
                  <ScopeContainer>

              Function renderTrendline has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                renderTrendline(maxHeight: number) {
                  const { width, trendLineData, echartOptions, refs } = this.props;
              
                  // if can't find any non-null values, no point rendering the trendline
                  if (!trendLineData?.some(d => d[1] !== null)) {

                Function buildQuery has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function buildQuery(formData: QueryFormData) {
                  const { groupby } = formData;
                  return buildQueryContext(formData, baseQueryObject => {
                    /* the `pivotOperatorInRuntime` determines how to pivot the dataframe returned from the raw query.
                       1. If it's a time compared query, there will return a pivoted dataframe that append time compared metrics. for instance:

                  Function getMemoizedSectionsToRender has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    (datasourceType: DatasourceType, controlPanelConfig: ControlPanelConfig) => {
                      const {
                        sectionOverrides = {},
                        controlOverrides,
                        controlPanelSections = [],
                  Severity: Minor
                  Found in superset-frontend/src/explore/controlUtils/getSectionsToRender.ts - About 1 hr to fix

                    Function updateResource has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        (resourceID: number, resource: D, hideToast = false, setLoading = true) => {
                          // Set loading state
                          if (setLoading) {
                            updateState({
                              loading: true,
                    Severity: Minor
                    Found in superset-frontend/src/views/CRUD/hooks.ts - About 1 hr to fix

                      Function useDrillByBreadcrumbs has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        useMemo(() => {
                          // the last breadcrumb is not clickable
                          const isClickable = (index: number) => index < breadcrumbsData.length - 1;
                          const isHidden = (breadcumb: DrillByBreadcrumb) =>
                            ensureIsArray(breadcumb.groupby).length === 0 &&

                        Function useResultsTableView has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const useResultsTableView = (
                          chartDataResult: QueryData[] | undefined,
                          datasourceId: string,
                          canDownload: boolean,
                        ) => {

                          Function formList has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                orderedFilters.map(id => {
                                  if (!renderedFilters.includes(id)) return null;
                                  const isDivider = id.startsWith(NATIVE_FILTER_DIVIDER_PREFIX);
                                  const isActive = currentFilterId === id;
                                  return (

                            Function rowRenderer has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              rowRenderer({ index, style }: { index: number; style: React.CSSProperties }) {
                                const { filteredSlices, selectedSliceIdsSet } = this.state;
                                const cellData = filteredSlices[index];
                            
                                const isSelected = selectedSliceIdsSet.has(cellData.slice_id);
                            Severity: Minor
                            Found in superset-frontend/src/dashboard/components/SliceAdder.tsx - About 1 hr to fix

                              Function CollapsibleControl has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const CollapsibleControl = (props: CollapsibleControlProps) => {
                                const {
                                  checked,
                                  disabled,
                                  title,

                                Function quantile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  quantile(q, formatter = usFmt) {
                                    return function ([attr]) {
                                      return function () {
                                        return {
                                          vals: [],

                                  Function sortKeys has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    sortKeys() {
                                      if (!this.sorted) {
                                        this.sorted = true;
                                        const v = (r, c) => this.getAggregator(r, c).value();
                                        switch (this.props.rowOrder) {

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

                                      constructor(props) {
                                        super(props);
                                        this.optionsForSelect = this.optionsForSelect.bind(this);
                                        this.onRemoveFilter = this.onRemoveFilter.bind(this);
                                        this.onNewFilter = this.onNewFilter.bind(this);
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language