Skip to content

Commit 817cfa9

Browse files
Use only pre-commit run
1 parent 435f332 commit 817cfa9

File tree

2 files changed

+5
-47
lines changed

2 files changed

+5
-47
lines changed

Makefile

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,13 @@
1-
.PHONY: hoogle format lint requires_nix_shell
1+
.PHONY: hoogle checks requires_nix_shell
22

33
hoogle: requires_nix_shell
44
hoogle server --local --port=8070 > /dev/null &
55

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
489

4910
# Target to use as dependency to fail if not inside nix-shell
5011
requires_nix_shell:
5112
@ [ "$(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)

flake.nix

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@
4646
# `cabal`, `hlint` and `haskell-language-server` etc
4747
tools = {
4848
cabal = { };
49-
hlint = { };
5049
haskell-language-server = { };
51-
fourmolu = { };
52-
cabal-fmt = { };
5350
};
5451
# Non-Haskell shell tools go here
5552
buildInputs = with pkgs; [

0 commit comments

Comments
 (0)