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
There's a handful of scripts left that we don't actually use in the workflows...
scripts/docs-build
scripts/docs-serve
scripts/clean
scripts/lint
I'd like to clean those up a bit, but figured I'd start this as a discussion rather than a PR.
Given we've now got a nice build step, we could clean the two docs scripts into just scripts/docs, to use for serving the docs during development. That'll error on build failures anyway, and it feels like nicer naming. Potentially we could drop it altogether and just use mkdocs serve, but it's nice to be consistent here.
We could consider dropping scripts/clean? I've personally now got a global gitclean command that I use in repos to tidy up everything out of source control or "venv". Is the existing script useful for other contributors/maintainers? If we do keep it then I think we should change it to git clean -d -x --force --exclude=venv which is a much cleaner simpler approach to cleaning out the gumpf, and will work across all our encode projects.
The scripts/lint one is a bit odd, since it just replicates scripts/check but using in-place fix flags on the various commands. Is there a neater way for us to do this? Eg. Should we be running scripts/check --fix instead? Is that less convenient? Are there other good options here? If scripts/test fails the linting locally, perhaps we should just prompt the user with Running 'test/check' failed. I can fix this for you automatically. Do you want me to run 'scripts/check --fix' and retry? [y|n].
Agreed with 2/ too - scripts/clean sounds less useful now that we publish from CI, where the env is always "clean" anyway. (Also, I personally don't use the clean script.)
3/ A --fix flag is what I've seen in a lot of places (eg in the JS ecosystem). One alternative I thought about is scripts/lint [--check], but scripts/check [--fix] fits my brain better for some reason. Dunno how easy ternary operators are in bash but if most tools have some sort of flag to switch them from "check" to "fix in place", then we could use that. :-)
Chiming in, it probably doesn't matter too much, but I believe linters/formatters most often have a --check flag, which would map down easily from scripts/lint [--check] (Pass down --check to contained programs)
But it may be beneficial to be non-destructive at first, and require an explicit flag to modify the system.
Ah, I see. black and isort were indeed the formatters I was thinking of, and I knew flake8 didn't fix anything with or without a flag.
However, that shows that scripts/lint doesn't just replicate scripts/check, but instead runs different things with different flags. Nothing saying that couldn't be implemented as demonstrated though, since it would be only one place to modify a linter or formatter if needed, rather than two.
Personally I would rename scripts/lint to scripts/format and scripts/check to scripts/lint, but as I said, having the flag is also 👍 .
Activity
florimondmanca commentedon May 15, 2020
scripts/cleansounds less useful now that we publish from CI, where the env is always "clean" anyway. (Also, I personally don't use the clean script.)--fixflag is what I've seen in a lot of places (eg in the JS ecosystem). One alternative I thought about isscripts/lint [--check], butscripts/check [--fix]fits my brain better for some reason. Dunno how easy ternary operators are in bash but if most tools have some sort of flag to switch them from "check" to "fix in place", then we could use that. :-)StephenBrown2 commentedon May 15, 2020
Chiming in, it probably doesn't matter too much, but I believe linters/formatters most often have a
--checkflag, which would map down easily fromscripts/lint [--check](Pass down --check to contained programs)But it may be beneficial to be non-destructive at first, and require an explicit flag to modify the system.
florimondmanca commentedon May 15, 2020
It's actually a mix and depends on the tool:
seed-isort-configautoflake --in-placeflake8mypyblack --checkblackisort --check --diffisort --applySo I suppose we could end up with a
scripts/check [--fix]something like this…StephenBrown2 commentedon May 15, 2020
Ah, I see.
blackandisortwere indeed the formatters I was thinking of, and I knewflake8didn't fix anything with or without a flag.However, that shows that
scripts/lintdoesn't just replicatescripts/check, but instead runs different things with different flags. Nothing saying that couldn't be implemented as demonstrated though, since it would be only one place to modify a linter or formatter if needed, rather than two.Personally I would rename
scripts/linttoscripts/formatandscripts/checktoscripts/lint, but as I said, having the flag is also 👍 .