You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plugins (most notably isort and black) in .pre-commit-config.yaml are not updated by Dependabot and thus prone to become out of sync with the same dev tools used by tox (also see discussion with @jku in #582).
With Ruff as our linter now we can add tox -e reformat with ruff format {[testenv:lint]lint_dirs} in tox.ini. We could also add this immediately on tox -e lint by removing the --diff flag on ruff format, this would depend if the suggested reformatting changes should be reviewed first before being performed.
In my experience, reformatting and format checking + linting are usually separated. But I suppose we can combine them, now that both of them are so fast. The important thing is that tox -e lint fails CI, if the format is incorrect. What do others think?
I think the autofix/autoformat feature is not a must-have but I'm not complaining if it's there. I wouldn't add it to lint itself though -- it feels like there should be a way to "just test", not fix.
In python-tuf I added tox -e fix which ends up running something like
Activity
jku commentedon Feb 14, 2024
without understanding pre-commit much, how about this:
tox -e lint
fast (aka use ruff)tox -e lint
in a commit hookI think this would explicitly not use pre-commit itself though.
lukpueh commentedon Feb 14, 2024
The difference would be that
tox -e lint
doesn't reformat your code.jku commentedon Feb 14, 2024
A
tox -e reformat
command would be nice to have anyway maybelukpueh commentedon Feb 14, 2024
I'm always pro lighter toolchain.
L77H commentedon Jul 1, 2024
With Ruff as our linter now we can add
tox -e reformat
withruff format {[testenv:lint]lint_dirs}
in tox.ini. We could also add this immediately ontox -e lint
by removing the--diff
flag on ruff format, this would depend if the suggested reformatting changes should be reviewed first before being performed.lukpueh commentedon Jul 2, 2024
In my experience, reformatting and format checking + linting are usually separated. But I suppose we can combine them, now that both of them are so fast. The important thing is that
tox -e lint
fails CI, if the format is incorrect. What do others think?jku commentedon Jul 2, 2024
I think the autofix/autoformat feature is not a must-have but I'm not complaining if it's there. I wouldn't add it to
lint
itself though -- it feels like there should be a way to "just test", not fix.In python-tuf I added
tox -e fix
which ends up running something likelukpueh commentedon Jul 2, 2024
Agreed. Not so much because I want to be able just test, but more because I don't want change anyone's sources when they don't expect it.