Hacker News new | ask | show | jobs
by umvi 1593 days ago
What's the point of putting linters into CI? Is the point to fail the build if the code wasn't pre-formatted with i.e. Black? Or is the point to autoformat and autocommit the formatted code?
3 comments

> Is the point to fail the build if the code wasn't pre-formatted with i.e. Black?

It's this one

> Or is the point to autoformat

This one is done with pre-commit (which should probably be named pre-push?) hooks

> and autocommit the formatted code?

I don't think this one is done, and I think it's undesirable

Pre-commit hooks really happen when you type 'git commit'. If you have failing checks in them, your commit will be aborted.
> Is the point to fail the build if the code wasn't pre-formatted with i.e. Black?

It's this. Ensures that anything merged to master keeps the formatting conventions established in the project.

The former, in my case. Last thing I want is someone merging their own "creative interpretation" of proper formatting.