airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Consider simplifying this complex logical expression.
Open

        if (
          (origCol.isMetric || origCol.isPercentMetric) &&
          !origCol.key.includes(comparisonSuffix) &&
          origCol.isNumeric
        ) {
Severity: Major
Found in superset-frontend/plugins/plugin-chart-table/src/transformProps.ts - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if (
              (origCol.isMetric || origCol.isPercentMetric) &&
              !origCol.key.includes(ensureIsArray(timeOffsets)[0]) &&
              origCol.isNumeric
            ) {
    Severity: Major
    Found in superset-frontend/plugins/plugin-chart-table/src/transformProps.ts - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

          if (
            section.tabOverride === 'data' ||
            section.controlSetRows.some(rows =>
              rows.some(
                control =>
      Severity: Major
      Found in superset-frontend/src/explore/components/ControlPanelsContainer.tsx - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

            } else if (!isEmpty(shifts) || startDate) {
              let useStartDate = startDate;
              if (!startDate && !isEmpty(previousCustomFilter)) {
                useStartDate = previousCustomFilter[0]?.comparator.split(' : ')[0];
                useStartDate = moment(parseDttmToDate(useStartDate)).format(

          Function useListViewResource has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            resource: string,
            resourceLabel: string, // resourceLabel for translations
            handleErrorMsg: (errorMsg: string) => void,
            infoEnable = true,
            defaultCollectionValue: D[] = [],
          Severity: Major
          Found in superset-frontend/src/views/CRUD/hooks.ts - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

              if (
                cachedNativeIndicatorsForChart[chartId] &&
                areObjectsEqual(cachedFilterData?.appliedColumns, appliedColumns) &&
                areObjectsEqual(cachedFilterData?.rejectedColumns, rejectedColumns) &&
                cachedFilterData?.nativeFilters === nativeFilters &&

              Consider simplifying this complex logical expression.
              Open

                    if (!!setting.method && setting.method === 'Email') {
                      return (
                        (!setting.recipients?.length || validateEmails(setting.recipients)) &&
                        (!setting.cc || validateEmails(setting.cc)) &&
                        (!setting.bcc || validateEmails(setting.bcc))
              Severity: Major
              Found in superset-frontend/src/features/alerts/AlertReportModal.tsx - About 1 hr to fix

                Function createTime has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  mode: 'local' | 'utc',
                  year: number,
                  month = 0,
                  date = 1,
                  hours = 0,

                  Consider simplifying this complex logical expression.
                  Open

                    if (
                      errorJson &&
                      ('error' in errorJson || 'message' in errorJson || 'errors' in errorJson)
                    ) {
                      let err;

                    Consider simplifying this complex logical expression.
                    Open

                      if (
                        metrics.length === 1 &&
                        columns.length > 0 &&
                        xAxisLabel &&
                        !(

                      Function getBasePivotSettings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        getBasePivotSettings() {
                          // One-time extraction of pivot settings that we'll use throughout the render.
                      
                          const { props } = this;
                          const colAttrs = props.cols;

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

                        async (
                          formData,
                          datasourceId,
                          datasourceType,
                          isReplace,
                      Severity: Minor
                      Found in superset-frontend/src/explore/components/ExploreViewContainer/index.jsx - About 55 mins 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 onChange has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        onChange() {
                          const { type } = this.state;
                          const value = { type };
                          const errors = [];
                          const errMsg = t('Invalid lat/long configuration.');
                      Severity: Minor
                      Found in superset-frontend/src/explore/components/controls/SpatialControl.jsx - About 55 mins 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 renderEditor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        renderEditor(inModal = false) {
                          const minLines = inModal ? 40 : this.props.minLines || 12;
                          if (this.props.language) {
                            const style = {
                              border: `1px solid ${this.props.theme.colors.grayscale.light1}`,
                      Severity: Minor
                      Found in superset-frontend/src/explore/components/controls/TextAreaControl.jsx - About 55 mins 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 verify_rsa_key has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def verify_rsa_key(rsa_key: str, email: Optional[str]) -> str:
                          """Fetch the KEYS file and verify if the RSA key and email match."""
                          url = "https://downloads.apache.org/superset/KEYS"
                          response = requests.get(url)
                          if response.status_code == 200:
                      Severity: Minor
                      Found in RELEASING/verify_release.py - About 55 mins 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 load_random_time_series_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def load_random_time_series_data(
                          only_metadata: bool = False, force: bool = False
                      ) -> None:
                          """Loading random time series data from a zip file in the repo"""
                          tbl_name = "random_time_series"
                      Severity: Minor
                      Found in superset/examples/random_time_series.py - About 55 mins 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 __repr__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __repr__(self) -> str:
                              result = f"\n{self._get_changelog_version_head()}\n"
                              changelog = {
                                  "Database Migrations": "\n",
                                  "Features": "\n",
                      Severity: Minor
                      Found in RELEASING/changelog.py - About 55 mins 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 upgrade has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def upgrade():
                          bind = op.get_bind()
                          session: Session = db.Session(bind=bind)
                          truncated_count = 0
                          for entry in paginated_update(

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

                      def upgrade():
                          bind = op.get_bind()
                          session = db.Session(bind=bind)
                      
                          for slc in session.query(Slice).all():

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

                      def paginated_update(
                          query: Query,
                          print_page_progress: Optional[Union[Callable[[int, int], None], bool]] = None,
                          batch_size: int = DEFAULT_BATCH_SIZE,
                      ) -> Iterator[Any]:
                      Severity: Minor
                      Found in superset/migrations/shared/utils.py - About 55 mins 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

                      Severity
                      Category
                      Status
                      Source
                      Language