Closed AlexPatrie closed 1 year ago
To pass the SonarCloud Code Analysis of Cognitive Complexity, I have implemented an approach that replaces certain if, and, or, else statements with a dictionary-based approach.
For example, SonarCloud references line 150 of config.py to have crossed the acceptable threshold of cognitive complexity:
config = config or get_config()
To work around this issue without changing the threshold, I propose the following:
config = {True: config, False: get_config()}.get(bool(config), config)
Here, it either assigns the value of config or the result of get_config() back into the config variable, effectively updating its value based on the boolean condition.
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
5 Code Smells
No Coverage information
0.0% Duplication
@AlexPatrie Congrats on your first PR! This looks great :-)
Added explicit typing to arguments for functions within the core sub-module for clarity in multi-type/module-specific objects.