Skip to content

Commit

Permalink
Update with final linting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
shonfeder committed Jun 11, 2024
1 parent 450a7e5 commit c935b4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions lib/lint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,18 @@ module Check = struct
| Some _ -> (pkg, ExtraFiles) :: errors

module Prefix = struct
(* For context, see https://github.com/ocurrent/opam-repo-ci/pull/316#issuecomment-2160069803 *)
let prefix_conflict_class_map = [
("arch-", "ocaml-architecture-setting");
("system-", "ocaml-system-setting");
("host-arch-", "ocaml-host-archicture");
("mysys2-", "msys2-env");
("arch-", "ocaml-arch");
("ocaml-env-mingw", "ocaml-env-mingw");
("ocaml-env-msvc", "ocaml-env-msvc");
("host-arch-", "ocaml-host-arch");
("host-system-", "ocaml-host-system");
("msys2-", "msys2-environment");
("system-", "ocaml-system");
]

let conflict_class_prefix_map = List.map (fun (a, b) -> b, a) prefix_conflict_class_map
let conflict_class_prefix_map = List.map (fun (a, b) -> (b, a)) prefix_conflict_class_map

let prefixes = List.map fst prefix_conflict_class_map

Expand Down
4 changes: 2 additions & 2 deletions test/lint.t
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ Tests the following:
Error "6 errors:
Error in b.0.0.1: warning 25: Missing field 'authors'
Error in b.0.0.2: error 3: File format error in 'unknown-field' at line 11, column 0: Invalid field unknown-field
Error in b.0.0.3: package with conflict class 'ocaml-host-archicture' requires name prefix 'host-arch-'
Error in b.0.0.3: package with conflict class 'ocaml-host-arch' requires name prefix 'host-arch-'
Error in b.0.0.3: pin-depends present. This is not allowed in the opam-repository.
Error in system-b.0.0.1: package with prefix 'system-' requires conflict class 'ocaml-system-setting'
Error in system-b.0.0.1: package with prefix 'system-' requires conflict class 'ocaml-system'
Warning in system-b.0.0.1: package name has restricted prefix 'system-'"

Reset commit and clear build cache
Expand Down
2 changes: 1 addition & 1 deletion test/patches/b-incorrect-opam.patch
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ index 0000000..5bab63e
+ "a-1" {< "0.0.2"}
+]
+conflict-class: [
+ "ocaml-host-archicture"
+ "ocaml-host-arch"
+]
+pin-depends: [ "foo.~dev" "git+https://github.com/bar/foo" ]
diff --git a/packages/system-b/system-b.0.0.1/opam b/packages/system-b/system-b.0.0.1/opam
Expand Down

0 comments on commit c935b4f

Please sign in to comment.