biosimulators / Biosimulators_COPASI

COPASI biochemical network simulation program via BioSimulators-compliant command-line interface and Docker container
https://docs.biosimulators.org/Biosimulators_COPASI
MIT License
2 stars 3 forks source link

Explicit typing for arguments in core sub-module. #55

Closed AlexPatrie closed 1 year ago

AlexPatrie commented 1 year ago

Added explicit typing to arguments for functions within the core sub-module for clarity in multi-type/module-specific objects.

AlexPatrie commented 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.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 5 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

eagmon commented 1 year ago

@AlexPatrie Congrats on your first PR! This looks great :-)