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 yoda-conditions (SIM300) #4044

Merged
merged 2 commits into from
Jul 13, 2024
Merged

Conversation

echoix
Copy link
Member

@echoix echoix commented Jul 13, 2024

@echoix echoix added this to the 8.5.0 milestone Jul 13, 2024
@echoix echoix requested a review from ninsbl July 13, 2024 03:04
@github-actions github-actions bot added GUI wxGUI related Python Related code is in Python libraries module general labels Jul 13, 2024
ninsbl
ninsbl previously approved these changes Jul 13, 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.

The changes in spatial_extent.py are less obvious yoda comparisons as both sides are variables... Do you know why the order is changed there? Just curios for future programing...

@echoix
Copy link
Member Author

echoix commented Jul 13, 2024

The changes in spatial_extent.py are less obvious yoda comparisons as both sides are variables... Do you know why the order is changed there? Just curios for future programing...

I know, I double checked and was finding it weird at first. I was about to place an ignore directive. Yoda conditions are where the constants are at the left instead of right, and the single letter variables (W, E, N, S) are defined as literals (that is, a single constant value). Since the complete expressions were already complex enough for me to understand, I judged that it wasn't worse with it reversed, for anyone new that would need to read the code.

@echoix
Copy link
Member Author

echoix commented Jul 13, 2024

You're seeing that the changes are starting to be a bit more opinionated, as a lot of the big easy changes are already made.

There's also a big batch of single-violation fixes to do, (see the ruff tracking issue I made the other day) but I'm not sure how to combine them properly in a PR. Do you rather have a series of about 12-20 PRs that only have one violation to fix, but also helps tracking down what violations are enabled?

@ninsbl
Copy link
Member

ninsbl commented Jul 13, 2024

Do you rather have a series of about 12-20 PRs that only have one violation to fix, but also helps tracking down what violations are enabled?

As you prefer. I am fine with either approach...

@echoix
Copy link
Member Author

echoix commented Jul 13, 2024

Thanks again for taking the time to read these PRs for me. I hope you don't mind that I assign to you these. At least the PRs gets a first answer in less than a week. Thanks again!

@echoix
Copy link
Member Author

echoix commented Jul 13, 2024

I need to solve conflicts now, and will probably have to re-approve

@ninsbl
Copy link
Member

ninsbl commented Jul 13, 2024

I am finally back at a PC and can do more efficient reviews, compared to reviewing on a mobile phone... Happy to do batches of PRs when I have some available time...

@echoix echoix enabled auto-merge (squash) July 13, 2024 12:34
@echoix echoix merged commit d690d0c into OSGeo:main Jul 13, 2024
26 checks passed
@echoix echoix deleted the fix-yoda-conditions branch July 13, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general GUI wxGUI related libraries module Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants