|
1 |
| -.PHONY: hoogle format lint requires_nix_shell |
| 1 | +.PHONY: hoogle checks requires_nix_shell |
2 | 2 |
|
3 | 3 | hoogle: requires_nix_shell
|
4 | 4 | hoogle server --local --port=8070 > /dev/null &
|
5 | 5 |
|
6 |
| -ifdef FLAGS |
7 |
| -GHC_FLAGS = --ghc-options "$(FLAGS)" |
8 |
| -endif |
9 |
| - |
10 |
| -EXTENSIONS := -o -XTypeApplications -o -XPatternSynonyms |
11 |
| - |
12 |
| -# Run fourmolu formatter |
13 |
| -format: requires_nix_shell |
14 |
| - env -C ply-core fourmolu -i --check-idempotence $(EXTENSIONS) $(shell env -C ply-core fd -ehs) |
15 |
| - env -C ply-plutarch fourmolu -i --check-idempotence $(EXTENSIONS) $(shell env -C ply-plutarch fd -ehs) |
16 |
| - env -C example/offchain fourmolu -i --check-idempotence $(EXTENSIONS) $(shell env -C example/offchain fd -ehs) |
17 |
| - env -C example/onchain fourmolu -i --check-idempotence $(EXTENSIONS) $(shell env -C example/onchain fd -ehs) |
18 |
| - nixpkgs-fmt $(NIX_SOURCES) |
19 |
| - cabal-fmt -i $(CABAL_SOURCES) |
20 |
| - |
21 |
| -# Check formatting (without making changes) |
22 |
| -format_check: |
23 |
| - env -C ply-core fourmolu --mode check --check-idempotence $(EXTENSIONS) $(shell env -C ply-core fd -ehs) |
24 |
| - env -C ply-plutarch fourmolu --mode check --check-idempotence $(EXTENSIONS) $(shell env -C ply-plutarch fd -ehs) |
25 |
| - env -C example/offchain fourmolu -i --check-idempotence $(EXTENSIONS) $(shell env -C example/offchain fd -ehs) |
26 |
| - env -C example/onchain fourmolu -i --check-idempotence $(EXTENSIONS) $(shell env -C example/onchain fd -ehs) |
27 |
| - nixpkgs-fmt --check $(NIX_SOURCES) |
28 |
| - cabal-fmt -c $(CABAL_SOURCES) |
29 |
| - |
30 |
| -# Nix files to format |
31 |
| -NIX_SOURCES := $(shell fd -enix) |
32 |
| -# Cabal files to format |
33 |
| -CABAL_SOURCES := $(shell fd -ecabal) |
34 |
| - |
35 |
| -nixfmt: requires_nix_shell |
36 |
| - nixfmt $(NIX_SOURCES) |
37 |
| - |
38 |
| -nixfmt_check: requires_nix_shell |
39 |
| - nixfmt --check $(NIX_SOURCES) |
40 |
| - |
41 |
| -# Apply hlint suggestions |
42 |
| -lint: requires_nix_shell |
43 |
| - find -name '*.hs' -not -path './dist-*/*' -exec hlint --refactor --refactor-options="--inplace" {} \; |
44 |
| - |
45 |
| -# Check hlint suggestions |
46 |
| -lint_check: requires_nix_shell |
47 |
| - hlint $(shell fd -ehs) |
| 6 | +# Run pre-commit checks |
| 7 | +checks: requires_nix_shell |
| 8 | + pre-commit run |
48 | 9 |
|
49 | 10 | # Target to use as dependency to fail if not inside nix-shell
|
50 | 11 | requires_nix_shell:
|
51 | 12 | @ [ "$(IN_NIX_SHELL)" ] || echo "The $(MAKECMDGOALS) target must be run from inside a nix shell"
|
52 |
| - @ [ "$(IN_NIX_SHELL)" ] || (echo " run 'nix develop .#devEnv' first" && false) |
| 13 | + @ [ "$(IN_NIX_SHELL)" ] || (echo " run 'nix develop' first" && false) |
0 commit comments