airbnb/superset

View on GitHub
superset/views/base_api.py

Summary

Maintainability
C
1 day
Test Coverage

File base_api.py has 565 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/base_api.py - About 1 day to fix

    Function statsd_metrics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def statsd_metrics(f: Callable[..., Any]) -> Callable[..., Any]:
        """
        Handle sending all statsd metrics from the REST API
        """
    
    
    Severity: Minor
    Found in superset/views/base_api.py - About 35 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 related has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def related(self, column_name: str, **kwargs: Any) -> FlaskResponse:
            """Get related fields data.
            ---
            get:
              summary: Get related fields data
    Severity: Minor
    Found in superset/views/base_api.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

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

        def _get_extra_field_for_model(
            self, model: Model, column_name: str
        ) -> dict[str, str]:
            ret = {}
            if column_name in self.extra_fields_rel_fields:
    Severity: Minor
    Found in superset/views/base_api.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