@@ -60,7 +60,6 @@ Test the following:
60
60
$ opam-ci-check lint -r . -c b.0.0.1
61
61
Linting opam-repository at $TESTCASE_ROOT/. ...
62
62
Error in b.0.0.1: warning 25: Missing field ' authors'
63
- Error in b.0.0.1: Maintainer email missing. Please add a maintainer email to the opam file. Maintainer: Jane
64
63
Warning in b.0.0.1: The package has not replaced the following default, example tags: topics, project
65
64
[1]
66
65
$ opam-ci-check lint -r . -c b.0.0.2
@@ -187,3 +186,60 @@ Test presence of unexpected files in a-1.0.0.2 package
187
186
Linting opam-repository at $TESTCASE_ROOT/. ...
188
187
Error in a-1.0.0.2: Forbidden permission for file packages/a-1/a-1.0.0.2/opam. All files should have permissions 644.
189
188
[1]
189
+
190
+ # Maintainer contact lint
191
+
192
+ The maintainer contact lint requires that a package EITHER provide a URL for the
193
+ `bug-tracker` OR that at least one email is provided in the `maintainer` field.
194
+ If neither of there requirements are met, the check should fail, otherwise it
195
+ should passes.
196
+
197
+ Add multiple maintainers with no email and remove the bug-reports field from a
198
+ valid package:
199
+
200
+ $ git reset -q --hard initial-state
201
+ $ sed -i \
202
+ > -e ' s / maintainer.*/ maintainer: ["Maintainer1" "Maintaner2"]/' \
203
+ > -e '/bug-reports.*/d' \
204
+ > packages/a-1/a-1.0.0.1/opam
205
+ $ git diff packages/a-1/a-1.0.0.1/opam | grep '^[+-][^+-]'
206
+ -maintainer: "Maintainer <me@example .com>"
207
+ +maintainer: ["Maintainer1" "Maintaner2"]
208
+ -bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues"
209
+
210
+ Test that we report the expected linting error:
211
+
212
+ $ opam-ci-check lint -r . -c a-1.0.0.1
213
+ Linting opam-repository at $TESTCASE_ROOT /. ...
214
+ Error in a-1.0.0.1: warning 36: Missing field 'bug-reports'
215
+ Error in a-1.0.0.1: There is no way to contact the maintainer(s) 'Maintainer1, Maintaner2'. A package must either specify a url for 'bug-reports' or provide an email address in the 'maintainer' field.
216
+ [1]
217
+
218
+ Add one email to the maintainers, and ensure it now passes the maintainer
219
+ contact lint:
220
+
221
+ $ sed -i \
222
+ > -e 's/"Maintaner2"/"Maintaner2 <me@example .com>"/' \
223
+ > packages/a-1/a-1.0.0.1/opam
224
+ $ git diff packages/a-1/a-1.0.0.1/opam | grep '^[+-][^+-]'
225
+ -maintainer: "Maintainer <me@example .com>"
226
+ +maintainer: ["Maintainer1" "Maintaner2 <me@example .com>"]
227
+ -bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues"
228
+ $ opam-ci-check lint -r . -c a-1.0.0.1
229
+ Linting opam-repository at $TESTCASE_ROOT /. ...
230
+ Error in a-1.0.0.1: warning 36: Missing field 'bug-reports'
231
+ [1]
232
+
233
+ Just remove the email address, leaving the bug-reports and ensure that it now
234
+ passes linting:
235
+
236
+ $ git reset -q --hard initial-state
237
+ $ sed -i \
238
+ > -e 's/maintainer.*/maintainer: ["Maintainer1" "Maintaner2"]/' \
239
+ > packages/a-1/a-1.0.0.1/opam
240
+ $ git diff packages/a-1/a-1.0.0.1/opam | grep '^[+-][^+-]'
241
+ -maintainer: "Maintainer <me@example .com>"
242
+ +maintainer: ["Maintainer1" "Maintaner2"]
243
+ $ opam-ci-check lint -r . -c a-1.0.0.1
244
+ Linting opam-repository at $TESTCASE_ROOT /. ...
245
+ No errors
0 commit comments