airbnb/caravel

View on GitHub
superset/views/core.py

Summary

Maintainability
F
4 days
Test Coverage

File core.py has 791 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
Severity: Major
Found in superset/views/core.py - About 1 day to fix

    Function explore has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        def explore(
            self,
            datasource_type: str | None = None,
            datasource_id: int | None = None,
            key: str | None = None,
    Severity: Minor
    Found in superset/views/core.py - About 7 hrs 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 save_or_overwrite_slice has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def save_or_overwrite_slice(
            # pylint: disable=too-many-arguments,too-many-locals
            slc: Slice | None,
            slice_add_perm: bool,
            slice_overwrite_perm: bool,
    Severity: Minor
    Found in superset/views/core.py - About 2 hrs 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 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 explore has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def explore(
            self,
            datasource_type: str | None = None,
            datasource_id: int | None = None,
            key: str | None = None,
    Severity: Minor
    Found in superset/views/core.py - About 1 hr to fix

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

          def warm_up_cache(self) -> FlaskResponse:
              """Warms up the cache for the slice or table.
      
              Note for slices a force refresh occurs.
      
      
      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 save_or_overwrite_slice has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def save_or_overwrite_slice(
              # pylint: disable=too-many-arguments,too-many-locals
              slc: Slice | None,
              slice_add_perm: bool,
              slice_overwrite_perm: bool,
      Severity: Minor
      Found in superset/views/core.py - About 1 hr to fix

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

            def save_or_overwrite_slice(
        Severity: Major
        Found in superset/views/core.py - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

                      return self.generate_json(viz_obj, response_type)
          Severity: Major
          Found in superset/views/core.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return json_error_response(
            Severity: Major
            Found in superset/views/core.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return self.send_data_payload_response(viz_obj, payload)
              Severity: Major
              Found in superset/views/core.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return self.save_or_overwrite_slice(
                Severity: Major
                Found in superset/views/core.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return json_error_response(
                  Severity: Major
                  Found in superset/views/core.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return self.render_template(
                    Severity: Major
                    Found in superset/views/core.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return json_error_response(utils.error_msg_from_exception(ex), 400)
                      Severity: Major
                      Found in superset/views/core.py - About 30 mins to fix

                        Function dashboard_permalink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def dashboard_permalink(
                                self,
                                key: str,
                            ) -> FlaskResponse:
                                try:
                        Severity: Minor
                        Found in superset/views/core.py - About 25 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

                        There are no issues that match your filters.

                        Category
                        Status