airbnb/caravel

View on GitHub

Showing 2,441 of 6,157 total issues

Function findFilterScope has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const findFilterScope = (
  checkedKeys: string[],
  layout: Layout,
): NativeFilterScope => {
  if (!checkedKeys.length) {

    Function computeMaxFontSize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function computeMaxFontSize(
      input: GetTextDimensionInput & {
        maxWidth?: number;
        maxHeight?: number;
        idealFontSize?: number;

      Function onResize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const onResize = () => {
            const currentElement = elementRef.current;
            if (!currentElement) {
              return;
            }

        Function transformProps has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function transformProps(chartProps) {
          const {
            width,
            height,
            annotationData,

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

        export default function getFilterConfigsFromFormdata(form_data = {}) {
          const {
            date_filter,
            filter_configs = [],
            show_sqla_time_column,

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

              create(context) {
                const warned = [];
                return {
                  TemplateElement(node) {
                    const rawValue = node?.value?.raw;
        Severity: Minor
        Found in superset-frontend/tools/eslint-plugin-theme-colors/index.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 updateComponentParentsList has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function updateComponentParentsList({
          currentComponent,
          layout = {},
        }) {
          if (currentComponent && layout) {
        Severity: Minor
        Found in superset-frontend/src/dashboard/util/updateComponentParentsList.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 upgrade has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def upgrade():
            bind = op.get_bind()
            session = db.Session(bind=bind)
        
            dashboards = session.query(Dashboard).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 post has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def post(self) -> FlaskResponse:
                """Create a new database.
                ---
                post:
                  summary: Create a new database
        Severity: Minor
        Found in superset/databases/api.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 send has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def send(self) -> None:
                file_type, files = self._get_inline_files()
                title = self._content.name
                body = self._get_body(content=self._content)
                global_logs_context = getattr(g, "logs_context", {}) or {}
        Severity: Minor
        Found in superset/reports/notifications/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

        Function upgrade_filter_set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def upgrade_filter_set(filter_set: dict[str, Any]) -> int:
            changed_filters = 0
            upgrade_select_filters(filter_set.get("nativeFilters", {}).values())
            data_mask = filter_set.get("dataMask", {})
            native_filters = data_mask.pop("nativeFilters", {})

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

            def _get_body(self, content: NotificationContent) -> str:
                if content.text:
                    return self._error_template(
                        content.name, content.description or "", content.text
                    )
        Severity: Minor
        Found in superset/reports/notifications/slack_mixin.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 query has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def query(self, query_obj: QueryObjectDict) -> QueryResult:
                qry_start_dttm = datetime.now()
                query_str_ext = self.get_query_str_extended(query_obj)
                sql = query_str_ext.sql
                status = QueryStatus.SUCCESS
        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 tabs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def tabs(self) -> dict[str, Any]:
                if self.position == {}:
                    return {}
        
                def get_node(node_id: str) -> dict[str, Any]:
        Severity: Minor
        Found in superset/models/dashboard.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 add_sqllab_custom_filters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def add_sqllab_custom_filters(form_data: dict[Any, Any]) -> Any:
            """
            SQLLab can include a "filters" attribute in the templateParams.
            The filters attribute is a list of filters to include in the
            request. Useful for testing templates in SQLLab.
        Severity: Minor
        Found in superset/views/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_inner_cte_expression has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_inner_cte_expression(self, tokens: TokenList) -> TokenList | None:
                for token in tokens:
                    if self._is_identifier(token):
                        for identifier_token in token.tokens:
                            if (
        Severity: Minor
        Found in superset/sql_parse.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_chart_dataframe has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_chart_dataframe(
            chart_url: str, auth_cookies: Optional[dict[str, str]] = None
        ) -> Optional[pd.DataFrame]:
            # Disable all the unnecessary-lambda violations in this function
            # pylint: disable=unnecessary-lambda
        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 _wrapper has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _wrapper(
                self,
                f: Callable[..., Any],
                action: str | Callable[..., str] | None = None,
                object_ref: str | Callable[..., str] | Literal[False] | 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 _get_aggregate_funcs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def _get_aggregate_funcs(
            df: DataFrame,
            aggregates: dict[str, dict[str, Any]],
        ) -> dict[str, NamedAgg]:
            """
        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 dumps has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def dumps(  # pylint: disable=too-many-arguments
        Severity: Major
        Found in superset/utils/json.py - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language