Skip to content

Commit 3a73b82

Browse files
committed
Copy infrastructure for whitespace violations from agda repo
1 parent 8c21248 commit 3a73b82

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ testContainers:
2424
cd ./lib/containers && ./generate-haskell.sh && cabal build containers-prop
2525

2626
test : test/agda2hs testContainers
27+
check-whitespace
2728
make -C test
2829

2930
testHtml : test/agda2hs
@@ -37,3 +38,17 @@ clean :
3738

3839
docs :
3940
make -C docs html
41+
42+
FIXW_BIN = fix-whitespace
43+
44+
.PHONY : fix-whitespace ## Fix the whitespace issue.
45+
fix-whitespace : have-bin-$(FIXW_BIN) fix-whitespace.yaml
46+
$(FIXW_BIN)
47+
48+
.PHONY : check-whitespace ## Check the whitespace issue without fixing it.
49+
check-whitespace : have-bin-$(FIXW_BIN) fix-whitespace.yaml
50+
$(FIXW_BIN) --check
51+
52+
.PHONY : have-bin-% ## Installing binaries for developer services
53+
have-bin-% :
54+
@($* --help > /dev/null) || $(CABAL) install --ignore-project $*

fix-whitespace.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This file contains the project-specific settings for `fix-whitespace` a tiny
2+
# but useful tool to
3+
#
4+
# * Removes trailing whitespace.
5+
# * Removes trailing lines containing nothing but whitespace.
6+
# * Ensures that the file ends in a newline character.
7+
#
8+
# By default, fix-whitespace checks every directory under the current working
9+
# directory but no files. This program should be placed under a text-based
10+
# project.
11+
#
12+
# For directories,
13+
#
14+
# 1) excluded-dirs is a black-list of directories,
15+
# 2) included-dirs is a white-list of excluded-dirs
16+
#
17+
# For files,
18+
#
19+
# 3) included-files is a white-list of files,
20+
# 4) excluded-files is a black-list of included-files.
21+
#
22+
# The extended glob pattern can be used to specify file/directory names.
23+
# For details, see http://hackage.haskell.org/package/filemanip-0.3.6.3/docs/System-FilePath-GlobPattern.html
24+
#
25+
included-dirs:
26+
# Without this line the above path will be excluded.
27+
28+
excluded-dirs:
29+
- "**/MAlonzo" # matches every MAlonzo in any directory including the src/full/Agda/Compiler/MAlonzo
30+
- "**/dist*" # matches every dist* in any directory
31+
- .stack-work
32+
- _darcs
33+
- .git
34+
- .direnv
35+
36+
# Every matched filename is included unless it is matched by excluded-files.
37+
included-files:
38+
- "*.agda"
39+
- "*.agda-lib"
40+
- "*.cabal"
41+
- "*.el"
42+
- "*.hs"
43+
- "*.hs-boot"
44+
- "*.lagda"
45+
- "*.lhs"
46+
- "*.md"
47+
- "*.rst"
48+
- "*.x"
49+
- "*.y"
50+
- "*.yaml"
51+
- "*.yml"
52+
53+
excluded-files:
54+

0 commit comments

Comments
 (0)