usgo / gocongress

Annual US Go Congress Website
https://www.gocongress.org
MIT License
20 stars 17 forks source link

Fix all `Layout` offenses #233

Closed jaredbeck closed 3 years ago

jaredbeck commented 3 years ago

Commits deliberately kept separate for clarity, and in case of reversion.

neagle commented 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?

michaelhiiva commented 3 years ago

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:

Screenshot from 2021-06-20 11-47-44

It might be something to look at.

jaredbeck commented 3 years ago

.. 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.