chshersh / iris

🌈 Haskell CLI Framework supporting Command Line Interface Guidelines
https://hackage.haskell.org/package/iris
Mozilla Public License 2.0
173 stars 21 forks source link

Run pre-commit-hooks on CI #78

Closed chshersh closed 1 year ago

chshersh commented 1 year ago

To enforce that they're actually used.

marcellourbani commented 1 year ago

I'll have a go at this

marcellourbani commented 1 year ago

I see 3 possible ways to do this:

Any preference?

chshersh commented 1 year ago

That's a difficult question to answer 😅

Now I'm not even sure how to do this properly 🤔 In the future, pre-commit hooks will run tools like hlint and fourmolu. This means, the environment needs to install them somehow and this might be a bit involved.

We also have a job for running HLint on CI so we don't need duplication. Not sure if it makes sense to combine them under the single pre-commit umbrella or keep them separate 🤔 I'd love to avoid job duplication.

marcellourbani commented 1 year ago

my understanding is that pre-commit installs the required tools automatically, so that wouldn't be a problem . We might have to create our own plugins if they don't exist already

marcellourbani commented 1 year ago

I did consider adding this to say the cabal workflow but would run once per architecture, which seems overkill. As of pre-commit, my understanding is that to add hlint and formolou in pre-commit is only a matter of setting it in .pre-commit-config.yaml If you mean running it in regular pre-commit but not in CI, I think it's possible setting separate sections in the same file.

Not too sure, never heard about pre-commit until doing this

chshersh commented 1 year ago

I think I'm closing this issue without adding pre-commit hooks to CI with the following reasoning:

@marcellourbani Thanks for providing all the options and participating in the discussion! It really helped me to understand the desired workflow 🙂

I've also created a separate issue to add HLint as a pre-commit hook:

Even if we can't guarantee the same version as on CI, I believe it's still useful. HLint doesn't break behaviour too often.