-
-
Notifications
You must be signed in to change notification settings - Fork 573
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 checker on PRs does not actually check anything #3571
Comments
I think the command
skips. The easiest fix would be to just do
Though that only runs ruff, so maybe
is better. |
There are ways to get pre-commit to run on only changed files as well, but using |
I would suggest running it on just the changed files in a PR. The style check is needed to pass for other checks to start, so it would be a nuisance if it fails due to issues in unchanged files. |
@kratman @agriyakhetarpal I was exploring on this and came across this command for only the changed files in the PR.
If it looks fine , can i please work on this issue ? |
@shubhambhar007 Yep feel free to work on the issue. |
Style checker on PRs does not actually check anything #3571
Fixed in #3580 |
I think this isn't working, again: here are some recent logs where I think we can run it on all files as well – if anything fails, it will be a one-time change, on further PRs, we will then have a clean output from this command. This is what I use for https://pybamm.org – @nox.session(name="lint", venv_backend="virtualenv")
def lint(session):
"""Install 'pre-commit' and run linting on all files."""
session.install("pre-commit")
session.run("pre-commit", "run", "--all-files", "--show-diff-on-failure") which is essentially very similar to what the Scientific Python guidelines recommend (except for the fact that they recommend PyLint too; we usually skip that) |
I think we don't need the extra nox function. We just add the |
@agriyakhetarpal any idea as to why this might not be working? While --all may be slow but i think it is best to have it running slowly rather than nor running at all at times. |
@shubhambhar007 the add probably only looks for locally changed files that were not committed while PRs have all changes committed. I think when I have seen this done on other projects they used a diff to a commit hash. Running with --all is still orders of magnitude faster than the rest of our checks. All changes to style settings are supposed to have isolated commits to hide them from git blame, so I don't think there are really any downsides to using --all |
I guess it would be great to migrate to the pre-commit GitHub Action for this in the long term to get results that bear similarity with the pre-commit bot |
@agriyakhetarpal got it, thanks :D |
PyBaMM Version
develop
Python Version
N/A
Describe the bug
The style job in the
test_on_push.yml
workflow does not notice any files to lint/auto-format and therefore is passing silently.Steps to Reproduce
It can be noticed in the checks on any of the PRs, for example:
https://github.com/pybamm-team/PyBaMM/actions/runs/7009110613/job/19066860618?pr=3569#step:4:65
Relevant log output
No response
The text was updated successfully, but these errors were encountered: