Skip to content

Commit 4d298d3

Browse files
authored
Merge pull request #10376 from geekosaur/make-fix-whitespace
add Makefile targets for fix-whitespace
2 parents 65230be + 2858dc0 commit 4d298d3

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

.github/workflows/whitespace.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,21 @@ on:
77

88
jobs:
99
whitespace:
10+
defaults:
11+
run:
12+
shell: bash
1013
runs-on: ubuntu-latest
1114

1215
steps:
16+
1317
- uses: actions/checkout@v4
14-
- uses: andreasabel/fix-whitespace-action@v1
15-
with:
16-
verbose: true
18+
19+
- run: |
20+
# no longer using the action because apparently we're supposed to use the Makefile here
21+
wget -q https://github.com/agda/fix-whitespace/releases/download/v0.1/fix-whitespace-0.1-linux.binary
22+
mkdir -p "$HOME/.local/bin"
23+
mv fix-whitespace-0.1-linux.binary "$HOME/.local/bin/fix-whitespace"
24+
chmod +x "$HOME/.local/bin/fix-whitespace"
25+
echo "$HOME/.local/bin" >> $GITHUB_PATH
26+
27+
- run: make whitespace

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ the code base.
196196

197197
We use automated whitespace convention checking. Violations can be fixed by
198198
running [fix-whitespace](https://hackage.haskell.org/package/fix-whitespace). If
199-
you push a fix of a whitespace violation, please do so in a _separate commit_.
199+
you push a fix of a whitespace violation, please do so in a _separate commit_. For convenience,
200+
`make whitespace` will show violations and `make fix-whitespace` will fix them, if the
201+
`fix-whitespace` utility is installed.
200202

201203
## Other Conventions
202204

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ style-commit: ## Run the code styler on the previous commit
4141
@git diff --name-only HEAD $(COMMIT) Cabal Cabal-syntax cabal-install \
4242
| grep '.hs$$' | xargs -P $(PROCS) -I {} fourmolu -q -i {}
4343

44+
.PHONY: whitespace
45+
whitespace: ## Run fix-whitespace in check mode
46+
fix-whitespace --check --verbose
47+
48+
.PHONY: fix-whitespace
49+
fix-whitespace: ## Run fix-whitespace in fix mode
50+
fix-whitespace --verbose
51+
4452
# source generation: SPDX
4553

4654
SPDX_LICENSE_HS:=Cabal-syntax/src/Distribution/SPDX/LicenseId.hs

0 commit comments

Comments
 (0)