-
Notifications
You must be signed in to change notification settings - Fork 107
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
More ruff & pre-commit rules #546
Conversation
Adjust format of pre-commit config to more conventional YAML style
IMPORTANT: Ruff isn't added to requirements.txt because it's run through pre-commit
Mostly organizing imports with isort ("I") ruleset
for more information, see https://pre-commit.ci
👈 Launch a binder notebook on this branch for commit 2bd77fd I will automatically update this comment whenever this PR is modified 👈 Launch a binder notebook on this branch for commit b479d90 👈 Launch a binder notebook on this branch for commit b86a68a 👈 Launch a binder notebook on this branch for commit fa768ed 👈 Launch a binder notebook on this branch for commit 5011535 👈 Launch a binder notebook on this branch for commit facfd46 👈 Launch a binder notebook on this branch for commit 3956ca7 👈 Launch a binder notebook on this branch for commit a4cf9df 👈 Launch a binder notebook on this branch for commit 0b7447f 👈 Launch a binder notebook on this branch for commit 3c22771 |
Since pre-commit on the default branch is configured to use Black without isort, pre-commit.ci is fighting with the new formatter config. Because of that, we'll need to format again after merging. I prefer to turn off this auto-commit behavior so it can be controlled by the user posting an autofix comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the crazy merge conflict. Maybe we should sort the rules under [tool.ruff.lint]
alphabetically too?
- id: trailing-whitespace | ||
args: [--markdown-linebreak-ext=md] | ||
- id: requirements-txt-fixer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't be needed if #552 goes ahead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Wei Ji <[email protected]>
Thanks! Interesting. I've not worked on a project that requires squash merges for more than a PR or two. It really causes problems for chained PRs. Is there a common practice for dealing with this? If we always updated the feature branch via rebase, then it would be a bit less messy. Briefly, I'd like to ask if there's any way you can think of we can utilize your review time more efficiently! I really appreciate all the work you've been doing on this! Would you be OK with "conditional approvals" in cases like this one where there are some "must-change" items, like sort order or config keys, and some "prefer-change" items like removing the pyproject checker rule, and once the "must-change" items are addressed, the PR can merge without additional review? I'm totally OK with waiting for a final check, I'm just worried I'm taking a lot of your time! ❤️ |
I'm not sure what's up with Travis. I get a blank response: https://app.travis-ci.com/github/icesat2py/icepyx/builds/271864435 |
Best practice is to have small commits that don't change so many files at once 🙂 I've got a good side-by-side merge conflict resolving tool with Gitkraken, so it wasn't too bad to resolve things.
Personally I dislike rebases because as a reviewer, it undos all the 'Viewed' checkboxes I've clicked on the 'Files Changed' tab, and I have to go back and re-read the lines of code (that may not have changed), instead of focusing on the lines that have actually changed. Also, if there are co-authored commits, some of those commits will become 'Unverified' because you do not have the co-author's GPG signing keys.
First off, I think you're doing a good job at this. Icepyx's development has been focused more on features for the longest time (i.e. as long as it works, doesn't matter if it's not formatted nicely). Usually in unformatted codebases like this, I'd use an incremental linter like On the topic of "must-" vs "prefer-" changes, one way I usually do this is to pre-approve once all the "must-" changes are satisfied, and the "prefer-" changes is left to the contributor to decide if they want to apply it or not. Generally, I try to suggest changes that will make it easier for the next person looking at the code, whether it's by making it clear where a new Ruff rule will go in (hence alphabetical sorting), or minimizing the diff between commits (easier to do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With that said ☝️, approving with one comment 🚀
That's my usual practice, that's the tradeoff with autofixes :) Please let me know if see any instances where I can break things up better!
Agree, that's frustrating. On the flip-side, all of the commits from a dependent PR are in here :(
That all sounds great! Do you have any thoughts about a process for reviewing |
Another thought on squash merges: on other projects I've used |
The module was renamed by a Ruff rule, but there are tests that depend on the name of the module. Those tests are updated to the new module name. The legacy module was named without the `test_` prefix so that it wouldn't be collected by the test runner. Because it does contain tests, the prefix is added back, and now we tell the test runner to skip the module and why.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development #546 +/- ##
===============================================
- Coverage 65.37% 65.36% -0.02%
===============================================
Files 36 36
Lines 3038 3037 -1
Branches 531 531
===============================================
- Hits 1986 1985 -1
Misses 970 970
Partials 82 82 ☔ View full report in Codecov by Sentry. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
No description provided.