Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Fix needless-bool (SIM103) #4055

Merged
merged 6 commits into from
Jul 21, 2024
Merged

Conversation

echoix
Copy link
Member

@echoix echoix commented Jul 14, 2024

Return the condition directly
Ruff rule: https://docs.astral.sh/ruff/rules/needless-bool/

Added bool return type annotations when possible to confirm no other type was possible on changed functions

Return the condition directly
Ruff rule: https://docs.astral.sh/ruff/rules/needless-bool/

Added bool return type annotations when possible to confirm no other type was possible on changed functions
@echoix echoix added this to the 8.5.0 milestone Jul 14, 2024
@echoix echoix requested a review from ninsbl July 14, 2024 21:32
@github-actions github-actions bot added GUI wxGUI related raster Related to raster data processing Python Related code is in Python libraries module docs general labels Jul 14, 2024
Copy link
Member

@ninsbl ninsbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in princple. Shortens and simplifies the code (reduces branches)...
I have some comments and suggestions for even further-reaching implementation.
But also here, you may have reasons to not include all possible changes... If so, I will approve after your reply...

gui/wxpython/modules/colorrules.py Show resolved Hide resolved
gui/wxpython/rlisetup/functions.py Show resolved Hide resolved
python/grass/temporal/spatial_extent.py Outdated Show resolved Hide resolved
python/grass/temporal/spatial_extent.py Outdated Show resolved Hide resolved
python/grass/temporal/temporal_extent.py Outdated Show resolved Hide resolved
python/grass/temporal/temporal_extent.py Outdated Show resolved Hide resolved
python/grass/temporal/temporal_extent.py Outdated Show resolved Hide resolved
python/grass/temporal/temporal_extent.py Show resolved Hide resolved
gui/wxpython/iclass/frame.py Outdated Show resolved Hide resolved
gui/wxpython/iclass/frame.py Outdated Show resolved Hide resolved
@echoix
Copy link
Member Author

echoix commented Jul 21, 2024

Checked with ruff 0.5.4 and still passes.

@echoix echoix requested a review from ninsbl July 21, 2024 17:00
@echoix echoix merged commit 1f6fa6c into OSGeo:main Jul 21, 2024
26 checks passed
@echoix echoix deleted the fix-needless-bool branch July 21, 2024 17:07
Mahesh1998 pushed a commit to Mahesh1998/grass that referenced this pull request Sep 19, 2024
* style: Fix needless-bool (SIM103)

Return the condition directly
Ruff rule: https://docs.astral.sh/ruff/rules/needless-bool/

Added bool return type annotations when possible to confirm no other type was possible on changed functions

* Update frame.py

* Apply suggestions from code review

Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com>

* style: Merge more if conditions per review

---------

Co-authored-by: Stefan Blumentrath <stefan.blumentrath@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs general GUI wxGUI related libraries module Python Related code is in Python raster Related to raster data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants