Closed jaredbeck closed 3 years ago
I know next to nothing about Ruby/Rails tools for formatting & style: is there a tool to re-format files according to project specifications on save in one's editor and/or in a git pre-commit hook?
In the AGAGD we use pre-commit (https://pre-commit.com/) for our linting. It can be used both locally and within GitHub actions. pre-commit has a nice feature which checks for code style on each commit. On the AGAGD we require linting tests pass before anything can be committed to the main branch.
There seems to be some support for ruby:
It might be something to look at.
.. is there a tool to re-format files ..
Yes, please use rubocop --auto-correct
.
On the AGAGD we require linting tests pass before anything can be committed to the main branch.
Now that we have CI again, it will run rubocop for us (as part of the default rake task). If this can be easily enforced on the main branch, without adding any new dependencies, I'd be open to that.
Commits deliberately kept separate for clarity, and in case of reversion.