Skip to content

Commit 6ecd0a9

Browse files
Add hooky config (#12)
* Add hooky config * Run hooky * Run hooky in CI
1 parent 1f1222a commit 6ecd0a9

4 files changed

Lines changed: 90 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- main
77
workflow_call:
88

9+
defaults:
10+
run:
11+
shell: bash -eu -o pipefail {0}
12+
913
jobs:
1014
build_and_test:
1115
strategy:
@@ -60,21 +64,26 @@ jobs:
6064

6165
lint:
6266
runs-on: ubuntu-latest
63-
env:
64-
FOURMOLU_VERSION: '0.19.0.1'
6567
steps:
6668
-
6769
uses: actions/checkout@v3
6870
-
69-
name: Install fourmolu
71+
name: Install hooky
7072
run: |
71-
curl -sSL \
72-
"https://github.com/fourmolu/fourmolu/releases/download/v${FOURMOLU_VERSION}/fourmolu-${FOURMOLU_VERSION}-linux-x86_64" \
73-
-o /usr/local/bin/fourmolu
74-
chmod +x /usr/local/bin/fourmolu
75-
-
76-
name: Run fourmolu
77-
run: fourmolu -m check .
73+
curl -fsSL \
74+
https://github.com/brandonchinn178/hooky/releases/download/v1.0.0/hooky-1.0.0-linux-x86_64 \
75+
-o /usr/local/bin/hooky
76+
chmod +x /usr/local/bin/hooky
77+
-
78+
name: Install dotslash
79+
run: >
80+
curl -fsSL https://github.com/facebook/dotslash/releases/latest/download/dotslash-ubuntu-22.04.$(uname -m).tar.gz
81+
| tar xzf - -C /usr/local/bin/
82+
-
83+
name: Run hooky
84+
run: hooky run --all --format=verbose
85+
env:
86+
SKIP: no_commit_to_branch
7887

7988
build_sdist:
8089
runs-on: ubuntu-latest

.hooky.kdl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
defaults {
2+
files !*.snap.md
3+
}
4+
5+
hook hooky {
6+
command hooky lint {
7+
fix_args --fix
8+
pass_files file
9+
}
10+
files *
11+
}
12+
13+
hook fourmolu {
14+
command "tools/fourmolu" {
15+
check_args -m check
16+
fix_args -m inplace
17+
}
18+
files *.hs
19+
}
20+
21+
lint_rules {
22+
- check_broken_symlinks
23+
- check_case_conflict
24+
- check_merge_conflict
25+
- end_of_file_fixer
26+
- no_commit_to_branch
27+
- trailing_whitespace
28+
}

src/KDL/Parser/Hustle/Types.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Data.Void ( Void )
1717
import Text.Megaparsec ( Parsec )
1818

1919
{-
20-
String has exactly one use,
20+
String has exactly one use,
2121
and that’s showing Hello World in tutorials.
2222
-- Albert Einstein
2323
-}
@@ -28,11 +28,11 @@ newtype Document = Document
2828
}
2929
deriving (Eq)
3030

31-
{-
31+
{-
3232
This data type serves as an abstraction over Values
3333
and Properties of a Node, in order simplify the the node
3434
Parser, i.e group the two types together to
35-
consume any number of them in any order.
35+
consume any number of them in any order.
3636
-}
3737
data Content
3838
= NodeValue { getValue :: Value }
@@ -65,7 +65,7 @@ data ValueType
6565
| NullValue
6666
deriving (Show, Eq)
6767

68-
{-
68+
{-
6969
This allows for querying properties in alphabetical order
7070
upon printing out, the rest is handled automatically by Map.
7171
-}

tools/fourmolu

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env dotslash
2+
{
3+
"name": "fourmolu-0.19.0.1",
4+
"platforms": {
5+
"macos-aarch64": {
6+
"size": 100525160,
7+
"hash": "sha256",
8+
"digest": "e8e793f2c361ad6e506fce46f4b89d46fce2af6647e753dc088fb005b650bb8c",
9+
"path": "fourmolu",
10+
"providers": [
11+
{
12+
"url": "https://github.com/fourmolu/fourmolu/releases/download/v0.19.0.1/fourmolu-0.19.0.1-osx-arm64"
13+
}
14+
]
15+
},
16+
"macos-x86_64": {
17+
"size": 33288184,
18+
"hash": "sha256",
19+
"digest": "eb60ab166bcd4d51d9b2d0eb4f27918c4ab9b4ca88eaac491ef5135a2b9fb0dd",
20+
"path": "fourmolu",
21+
"providers": [
22+
{
23+
"url": "https://github.com/fourmolu/fourmolu/releases/download/v0.19.0.1/fourmolu-0.19.0.1-osx-x86_64"
24+
}
25+
]
26+
},
27+
"linux-x86_64": {
28+
"size": 68679136,
29+
"hash": "sha256",
30+
"digest": "2c5ccd4be51e72dcbd09468d6e62082fc3a47f5fabdd8c6979729129bc81e755",
31+
"path": "fourmolu",
32+
"providers": [
33+
{
34+
"url": "https://github.com/fourmolu/fourmolu/releases/download/v0.19.0.1/fourmolu-0.19.0.1-linux-x86_64"
35+
}
36+
]
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)