@@ -109,19 +109,19 @@ Next we are going to test the command with config.
109
109
110
110
The command may be passed a config file.
111
111
112
- $ printf ' ((rules ()))\n' > . dunolint
112
+ $ printf ' ((rules ()))\n' > dunolint
113
113
114
- $ dunolint tools lint dune -- config= . dunolint
114
+ $ dunolint tools lint dune -- config= dunolint
115
115
(library
116
116
(name mylib)
117
117
(libraries a b c))
118
118
119
119
To make it easier to write in this test, we're generating an actual config from
120
120
an OCaml file.
121
121
122
- $ ./ lint_file_config_gen. exe > . dunolint
122
+ $ ./ lint_file_config_gen. exe > dunolint
123
123
124
- $ cat . dunolint
124
+ $ cat dunolint
125
125
;; This file is generated by [bin/ lint_file_gen_config. ml]. Do not edit!
126
126
((version 0 )
127
127
((skip_subtree (cond (((path (glob . git/* )) skip_subtree))))
@@ -137,18 +137,27 @@ an OCaml file.
137
137
> (name my_project_name)
138
138
> EOF
139
139
140
- Currently the behavior of the lint-file command is to not load config files on
141
- its own. See below how the name of the project is not linted:
140
+ Currently the behavior of the lint-file command is to load a config file on its
141
+ own if it is in the current cwd and named " dunolint" . See below how the name of
142
+ the project is indeed linted:
142
143
143
144
$ dunolint tools lint-file dune-project
144
145
(lang dune 3.17 )
145
146
147
+ (name foo)
148
+
149
+ However, you may supply a config to use .
150
+
151
+ $ printf " ((rules()))\n " > empty-config
152
+ $ dunolint tools lint-file dune-project -- config= empty-config
153
+ (lang dune 3.17 )
154
+
146
155
(name my_project_name)
147
156
148
- However, you may supply a config to use . The test config enforces the project
149
- name so its effect is visible in this test (it is changed to " foo" ):
157
+ The test config enforces the project name so its effect is visible in this test
158
+ (it is changed to " foo" ):
150
159
151
- $ dunolint tools lint-file dune-project -- config= . dunolint
160
+ $ dunolint tools lint-file dune-project -- config= dunolint
152
161
(lang dune 3.17 )
153
162
154
163
(name foo)
@@ -170,7 +179,7 @@ The path that is used by the config is the filename supplied when it is
170
179
overridden. In particular note how here we are executing the `return ` statement
171
180
of the config.
172
181
173
- $ dunolint tools lint-file dune-project -- config= . dunolint \
182
+ $ dunolint tools lint-file dune-project -- config= dunolint \
174
183
> -- filename= vendor/ dune-project
175
184
(lang dune 3.17 )
176
185
@@ -179,20 +188,20 @@ of the config.
179
188
If the file is at a path configured to be in a skipped directory, the command
180
189
won't apply linting rules to it.
181
190
182
- $ cat dune | dunolint tools lint-file -- filename= . git/ dune
191
+ $ cat dune | dunolint tools lint-file -- filename= . git/ dune -- config = empty-config
183
192
(library
184
193
(name mylib)
185
194
(libraries a b c))
186
195
187
- $ cat dune | dunolint tools lint-file -- filename= . git/ dune -- config= . dunolint
196
+ $ cat dune | dunolint tools lint-file -- filename= . git/ dune -- config= dunolint
188
197
(library (name mylib)
189
198
(libraries b c a))
190
199
191
200
Note however that the result is currently different when the `skip_subtree` is
192
201
returned from a rule, rather than from the dedicated section. This is probably
193
202
confusing and we may revisit this later. Keeping as a regression test for now.
194
203
195
- $ cat dune | dunolint tools lint-file -- filename= _build/ dune -- config= . dunolint
204
+ $ cat dune | dunolint tools lint-file -- filename= _build/ dune -- config= dunolint
196
205
(library
197
206
(name mylib)
198
207
(libraries b c a))
0 commit comments