airbnb/caravel

View on GitHub
superset/initialization/__init__.py

Summary

Maintainability
D
2 days
Test Coverage

File __init__.py has 558 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/initialization/__init__.py - About 1 day to fix

    Function init_views has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def init_views(self) -> None:
            #
            # We're doing local imports, as several of them import
            # models which in turn try to import
            # the global Flask app
    Severity: Major
    Found in superset/initialization/__init__.py - About 5 hrs to fix

      SupersetAppInitializer has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class SupersetAppInitializer:  # pylint: disable=too-many-public-methods
          def __init__(self, app: SupersetApp) -> None:
              super().__init__()
      
              self.superset_app = app
      Severity: Minor
      Found in superset/initialization/__init__.py - About 3 hrs to fix

        Function configure_middlewares has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def configure_middlewares(self) -> None:
                if self.config["ENABLE_CORS"]:
                    # pylint: disable=import-outside-toplevel
                    from flask_cors import CORS
        
        
        Severity: Minor
        Found in superset/initialization/__init__.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

        There are no issues that match your filters.

        Category
        Status