sipa/initialization.py
Function init_env_and_config
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def init_env_and_config(app):
if not app.config.get("FLATPAGES_ROOT"):
app.config["FLATPAGES_ROOT"] = os.path.join(
os.path.dirname(__file__),
"../content",
- Read upRead up
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 init_app
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def init_app(app, **kwargs):
"""Initialize the Flask app located in the module sipa.
This initializes the Flask app by:
* calling the internal init_app() procedures of each module
Function load_config_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def load_config_file(app, config=None):
"""Just load the config file, do nothing else"""
# default configuration
from .config import default
- Read upRead up
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
Error: invalid syntax (<unknown>, line 154)</unknown> Open
Open
if url := app.config["CONTENT_URL"]:
- Read upRead up
- Exclude checks
We encountered an error attempting to analyze this line.