Skip to content

Commit 8fff261

Browse files
committed
Skip the 80ch check on autoformatted files
1 parent d46b893 commit 8fff261

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.github/workflows/80ch.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,17 @@ do
4949
# (a more sophisticated script would instead remove %%expect blocks)
5050
[[ "$changed_file" == testsuite/tests/* ]] && continue
5151

52+
# Don't check autoformatted files (there's a bug in `ocamlformat` that
53+
# sometimes produces lines over 80 characters)
54+
ocamlformat -m 1 "$changed_file" &> /dev/null || continue
55+
# |^^^
56+
# This setting causes `ocamlformat` to crash, but
57+
# only if the formatter is run. Thus, we can use
58+
# the return code to determine whether the file
59+
# is autoformatted
60+
5261
# Bash doesn't allow for comments on multiline commands, so excuse the
53-
# workaround of putting groups of argument in a variable
62+
# workaround of putting a group of arguments in a variable
5463
f='--old-line-format= --unchanged-line-format= --new-line-format=%dn:%L'
5564
# |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |^^^^^^^^^^^^^^^^^^^^^^^
5665
# Don't print deleted or unchanged lines Show added lines (%L),

.github/workflows/80ch.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [ubuntu-latest]
14+
ocaml-compiler:
15+
- "4.14.0"
1416

1517
steps:
1618
- name: Checkout the Flambda backend repo
@@ -19,5 +21,16 @@ jobs:
1921
- name: Checkout the parent branch
2022
run: git fetch origin HEAD --deepen 1
2123

24+
- name: Setup OCaml ${{ matrix.ocaml-compiler }}
25+
uses: ocaml/setup-ocaml@v3
26+
with:
27+
ocaml-compiler: ${{ matrix.ocaml-compiler }}
28+
29+
- name: Install a recent version of re
30+
run: opam install 're>=1.10.0'
31+
32+
- name: Install ocamlformat 0.24.1
33+
run: opam pin -y ocamlformat 0.24.1
34+
2235
- name: Check for new >80 character lines
23-
run: bash .github/workflows/80ch.sh
36+
run: opam exec -- bash .github/workflows/80ch.sh

0 commit comments

Comments
 (0)