airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function getState has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getState(
  vizType: string,
  datasource: Dataset,
  datasourceType: DatasourceType,
) {
Severity: Minor
Found in superset-frontend/src/explore/components/ControlPanelsContainer.tsx - About 1 hr to fix

    Function updatedChildren has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const updatedChildren = Children.map(children, row => {
        if ('children' in row.props) {
          const defaultWidth = Array.isArray(row.props.children)
            ? `${100 / row.props.children.length}%`
            : undefined;

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

      const buildQuery: BuildQuery<PluginFilterSelectQueryFormData> = (
        formData: PluginFilterSelectQueryFormData,
        options,
      ) => {
        const { search, coltypeMap } = options?.ownState || {};
      Severity: Minor
      Found in superset-frontend/src/filters/components/Select/buildQuery.ts - About 1 hr to fix

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

        export default function transformProps(chartProps: TableChartProps) {
          const { height, datasource, formData, queriesData } = chartProps;
          const { columnCollection = [], groupby, metrics, url } = formData;
          const { records, columns } = queriesData[0].data;
          const isGroupBy = groupby?.length > 0;
        Severity: Minor
        Found in superset-frontend/src/visualizations/TimeTable/transformProps.ts - About 1 hr to fix

          Function coerceMetrics has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const coerceMetrics = (
            addedMetrics: QueryFormMetric | QueryFormMetric[] | undefined | null,
            savedMetrics: Metric[],
            columns: ColumnMeta[],
          ) => {

            Function handleOverwriteDataset has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const handleOverwriteDataset = async () => {
                // if user wants to overwrite a dataset we need to prompt them
                if (!shouldOverwriteDataset) {
                  setShouldOverwriteDataset(true);
                  return;
            Severity: Minor
            Found in superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx - About 1 hr to fix

              Function initialValue has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                initialValue: (control: ControlState, state: ControlPanelState | null) => {
                  // skip initialValue if
                  // 1) the time_range control is present (this is the case for legacy charts)
                  // 2) there was a time filter in adhoc filters
                  if (

                Function Sankey has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function Sankey(element, props) {
                  const { data, width, height, colorScheme, sliceId } = props;
                  const div = d3.select(element);
                  div.classed(`superset-legacy-chart-sankey`, true);
                  const margin = {
                Severity: Minor
                Found in superset-frontend/plugins/legacy-plugin-chart-sankey/src/Sankey.js - 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 render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  render() {
                    const {
                      ariaLabel,
                      autoFocus,
                      clearable,
                Severity: Minor
                Found in superset-frontend/src/explore/components/controls/SelectControl.jsx - 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 render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  render() {
                    const { chartAlert, chartStatus, chartId, emitCrossFilters } = this.props;
                
                    // Skip chart rendering
                    if (chartStatus === 'loading' || !!chartAlert || chartStatus === null) {
                Severity: Minor
                Found in superset-frontend/src/components/Chart/ChartRenderer.jsx - 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 upgrade has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                def upgrade():
                    """
                    Adds the granularity param to charts without it populated. This is required for
                    time range filtering to work properly. Uses the following approach:
                
                

                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 12 (exceeds 5 allowed). Consider refactoring.
                Open

                def upgrade():
                    """
                    Remove any erroneous time granularity fields from slices foor those visualization
                    types which do not support time granularity.
                
                

                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 12 (exceeds 5 allowed). Consider refactoring.
                Open

                def upgrade():
                    bind = op.get_bind()
                    session = db.Session(bind=bind)
                
                    for slc in session.query(Slice).filter(Slice.viz_type.like("directed_force")):

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

                    def explore_json(
                        self, datasource_type: str | None = None, datasource_id: int | None = None
                    ) -> FlaskResponse:
                        """Serves all request that GET or POST form_data
                
                
                Severity: Minor
                Found in superset/views/core.py - 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 fetch_metadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fetch_metadata(self) -> MetadataResult:
                        """
                        Fetches the metadata for the table and merges it in
                
                        :return: Tuple with lists of added, removed and modified column names.
                Severity: Minor
                Found in superset/connectors/sqla/models.py - 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 df_to_escaped_csv has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                def df_to_escaped_csv(df: pd.DataFrame, **kwargs: Any) -> Any:
                    def escape_values(v: Any) -> Union[str, Any]:
                        return escape_value(v) if isinstance(v, str) else v
                
                    # Escape csv headers
                Severity: Minor
                Found in superset/utils/csv.py - 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 log_with_context has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    def log_with_context(  # pylint: disable=too-many-locals,too-many-arguments
                        self,
                        action: str,
                        duration: timedelta | None = None,
                        object_ref: str | None = None,
                Severity: Minor
                Found in superset/utils/log.py - 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 cidr_func has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                def cidr_func(req: AdvancedDataTypeRequest) -> AdvancedDataTypeResponse:
                    """
                    Convert a passed in AdvancedDataTypeRequest to a AdvancedDataTypeResponse
                    """
                    resp: AdvancedDataTypeResponse = {
                Severity: Minor
                Found in superset/advanced_data_type/plugins/internet_address.py - 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 validate_column_args has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                def validate_column_args(*argnames: str) -> Callable[..., Any]:
                    def wrapper(func: Callable[..., Any]) -> Callable[..., Any]:
                        def wrapped(df: DataFrame, **options: Any) -> Any:
                            if _is_multi_index_on_columns(df):
                                # MultiIndex column validate first level
                Severity: Minor
                Found in superset/utils/pandas_postprocessing/utils.py - 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 get_channels_with_search has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_channels_with_search(
                    search_string: str = "",
                    limit: int = 999,
                    types: Optional[list[SlackChannelTypes]] = None,
                    exact_match: bool = False,
                Severity: Minor
                Found in superset/utils/slack.py - 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

                Severity
                Category
                Status
                Source
                Language