-
Notifications
You must be signed in to change notification settings - Fork 118
Ruff fixes #455
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
base: main
Are you sure you want to change the base?
Ruff fixes #455
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #455 +/- ##
=======================================
Coverage 86.22% 86.22%
=======================================
Files 24 24
Lines 3419 3419
=======================================
Hits 2948 2948
Misses 471 471 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I really don't think we should be modifying the optimizer source code which we just vendor in - this large diff doesn't do anything for us. |
I'm also a little confused. How is the pre-commit supposed to be applied outside of CI? And is there a way to configure those per-repo? If the answer is no to either of those then we may want to rethink the pre-commit approach. |
I know it's a big diff, but we can put this PR's commit in
Download the config file from the .github repo and put it in the repo in question (or put it somewhere central and softlink to it in the repo). |
The I think the checks that are included in pre-commit are OK for some repos, but I question whether it should be applied uniformly across everything -- our previous checks had the option of per-repo configuration which allowed us to adjust these settings. In the case of pyOptSparse, I really don't think it's worth the effort, as we're simply vendoring code from others.
This is by design (which I agree with) and that's what makes me think pre-commit is ill-suited for what we are trying to do. Shared configs is in direct conflict with the idea of running pre-commit in isolated envs. Plus, the convoluted (and undocumented) setup process makes it really hard for others to work on these projects, which might not matter for some repos but does matter for pyOptSparse. |
I don't really see it as any effort to apply these whitespace fixes here (in fact, the point was to avoid the potential effort of having to undo whitespace changes automatically made by IDEs in future). But I can remove the
I'm not sure I follow this point. Sharing configs is for consistency across repos, pre-commit running in an isolated env is for consistency between what users run locally and what we run in CI.
I don't think the process for running the new checks locally is any more difficult than it was for black and flake8. In fact, in some sense it's easier because you don't need to do anything differently for repos that have a local linting config, like you did with flake8. I've opened a PR (mdolab/MACH-Aero#182) to update our contribution guide with new formatting and linting instructions. |
I think ultimately, my gripe is with the lack of configurability with this current setup. In the past, we had allowed each repo to define the set of rules that they would be compliant with (black, flake8, isort, pylint, etc.). Now, each repo is required to be compliant to all 10 rules stored here, and I think that causes unnecessary issues. Again, I think the vast majority of changes in this PR are somewhat unnecessary and difficult to review thoroughly. In addition to ruff, I'm fine with the mixed line ending changes. In any case, I don't want this PR to block all development in pyOptSparse, I just don't think a |
Purpose
Updates repo to pass our new formatting and linting checks. There are a lot of whitespace changes here so once this PR is merged we can add the commit hash to a
.git-blame-ignore-revs
file.Expected time until merged
Type of change
Testing
Checklist
ruff check
andruff format
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable