Skip to content

Commit f9c0ccd

Browse files
authored
Merge pull request #104 from mbarbin/more-dunolint-invariants
Add project specific dunolint invariants
2 parents 6a80497 + 2ffdffa commit f9c0ccd

File tree

2 files changed

+66
-24
lines changed

2 files changed

+66
-24
lines changed

bin/dune

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
(flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a)
66
(libraries cmdlang-cmdliner-err-runner volgo-vcs.volgo-vcs-cli)
77
(instrumentation
8-
(backend bisect_ppx)))
8+
(backend bisect_ppx))
9+
(lint
10+
(pps ppx_js_style -allow-let-operators -check-doc-comments)))

dunolint

Lines changed: 63 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,71 @@
11
(lang dunolint 1.0)
22

3-
;; Build & vcs
4-
(skip_paths
5-
_build/**
6-
_coverage/**
7-
_opam/**
8-
.git/**)
9-
10-
;; Docusaurus build & Co.
11-
(skip_paths
12-
doc/.docusaurus/**
13-
doc/build/**
14-
doc/node_modules/**)
15-
163
;; Everything is instrumented
174
(rule
18-
(enforce (dune (instrumentation (backend bisect_ppx)))))
5+
(enforce
6+
(dune
7+
(instrumentation
8+
(backend bisect_ppx)))))
9+
10+
;; Test lib naming
11+
(rule
12+
(cond
13+
((path
14+
(glob **/test/*))
15+
(enforce
16+
(dune
17+
(library
18+
(and
19+
(public_name
20+
(is_prefix volgo-tests.))
21+
(name
22+
(is_suffix _test)))))))))
1923

20-
;; We use linters via pps
24+
;; Configure the ppx_js_style linter
2125
(rule
2226
(enforce
2327
(dune
24-
(library
25-
(lint
26-
(pps
27-
(and
28-
(pp ppx_js_style)
29-
(flag (name -allow-let-operators) (param none) (applies_to (pp ppx_js_style)))
30-
(flag (name -check-doc-comments) (param none) (applies_to (pp ppx_js_style)))
31-
)))))))
28+
(lint
29+
(pps
30+
(and
31+
(pp ppx_js_style)
32+
(flag
33+
(name -allow-let-operators)
34+
(param none)
35+
(applies_to
36+
(pp ppx_js_style)))
37+
(flag
38+
(name -check-doc-comments)
39+
(param none)
40+
(applies_to
41+
(pp ppx_js_style)))))))))
42+
43+
;; Configure ppx flags
44+
(rule
45+
(cond
46+
((dune
47+
(preprocess (pps true)))
48+
(enforce
49+
(dune
50+
(preprocess
51+
(pps
52+
(flag
53+
(name -unused-code-warnings)
54+
(param
55+
(equals force))
56+
(applies_to driver)))))))))
57+
58+
;; With the exceptions of two libraries we made a deliberate effort not to
59+
;; depend on ppx except in dev mode for the user facing libraries in this
60+
;; project. Let's enforce this going forward.
61+
(rule
62+
(cond
63+
((path
64+
(or
65+
(glob **/volgo_base/**)
66+
(glob **/vcs_test_helpers/**)))
67+
return)
68+
((path (glob **/src/*))
69+
(enforce
70+
(dune
71+
(preprocess no_preprocessing))))))

0 commit comments

Comments
 (0)