-
-
Notifications
You must be signed in to change notification settings - Fork 411
Closed
Labels
status: needs triagetype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Description
Currently, nix develop complains:
nix-pre-commit-hooks: updating /home/kokobd/work/github.com/kokobd/haskell-language-server repo
nix-pre-commit-hooks: WARNING: Refusing to install because of pre-existing .pre-commit-config.yaml
1. Translate .pre-commit-config.yaml contents to the new syntax in your Nix file
see https://github.com/hercules-ci/nix-pre-commit-hooks#getting-started
2. remove .pre-commit-config.yaml
3. add .pre-commit-config.yaml to .gitignore
This problem was introduced by #2679, where .pre-commit-config.yaml was checked in git.
But according to our documentation, .pre-commit-config.yaml should be managed by Nix. People do not use Nix can just manually install pre-commit hook and paste the file content into .pre-commit-config.yaml
haskell-language-server/docs/contributing/contributing.md
Lines 171 to 216 in 09968a1
| ### Formatter pre-commit hook | |
| We are using [pre-commit-hook.nix](https://github.com/cachix/pre-commit-hooks.nix) to configure git pre-commit hook for formatting. Although it is possible to run formatting manually, we recommend you to use it to set pre-commit hook as our CI checks pre-commit hook is applied or not. | |
| You can configure the pre-commit-hook by running | |
| ``` bash | |
| nix-shell | |
| ``` | |
| If you don't want to use [nix](https://nixos.org/guides/install-nix.html), you can instead use [pre-commit](https://pre-commit.com) with the following config. | |
| ```json | |
| { | |
| "repos": [ | |
| { | |
| "hooks": [ | |
| { | |
| "entry": "stylish-haskell --inplace", | |
| "exclude": "(^Setup.hs$|test/testdata/.*$|test/data/.*$|test/manual/lhs/.*$|^hie-compat/.*$|^plugins/hls-tactics-plugin/.*$|^ghcide/src/Development/IDE/GHC/Compat.hs$|^ghcide/src/Development/IDE/Plugin/CodeAction/ExactPrint.hs$|^ghcide/src/Development/IDE/GHC/Compat/Core.hs$|^ghcide/src/Development/IDE/Spans/Pragmas.hs$|^ghcide/src/Development/IDE/LSP/Outline.hs$|^plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs$|^ghcide/test/exe/Main.hs$|ghcide/src/Development/IDE/Core/Rules.hs|^hls-test-utils/src/Test/Hls/Util.hs$)", | |
| "files": "\\.l?hs$", | |
| "id": "stylish-haskell", | |
| "language": "system", | |
| "name": "stylish-haskell", | |
| "pass_filenames": true, | |
| "types": [ | |
| "file" | |
| ] | |
| } | |
| ], | |
| "repo": "local" | |
| }, | |
| { | |
| "repo": "https://github.com/pre-commit/pre-commit-hooks", | |
| "rev": "v4.1.0", | |
| "hooks": [ | |
| { | |
| "id": "mixed-line-ending", | |
| "args": ["--fix", "lf"], | |
| "exclude": "test/testdata/.*CRLF*.hs$" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| ``` |
Now we have two options to compare:
- Remove
pre-commitconfig from Nix, and update the docs accordingly.- pros: Non-Nix users' life is made easier a little bit.
- cons: Nix users will have to install pre-commit hooks manually.
- Remove
.pre-commit-config.yamlfrom Git, and let Nix manage it again.- pros: Nix users can benefit from the pre-commit hooks without any extra setup.
- cons: Non-Nix users have to do one more manual step: paste the
.pre-commit-config.yaml
I recommend the second option, as Non-Nix users will have some manual setups anyway, and we were on option 2 before #2679 was merged.
Metadata
Metadata
Assignees
Labels
status: needs triagetype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..