|
|
@ -39,44 +39,36 @@ let opamlint () = |
|
|
|
if current path satisfies minimum requirements, when all sub directories |
|
|
|
have been traversed, or predicate is satified, it returns true. *) |
|
|
|
let rec check_dir_for_ml_and_dune in_path = |
|
|
|
let content = |
|
|
|
match Bos.OS.Dir.contents ~dotfiles:true ~rel:true in_path with |
|
|
|
| Error _e -> |
|
|
|
Utils.error |
|
|
|
( "Cant list contents of subdirectory " ^ Fpath.to_string in_path |
|
|
|
^ ". (Check_directory.check_dir_for_ml_and_dune)" ) |
|
|
|
| Ok contents -> contents |
|
|
|
in |
|
|
|
if |
|
|
|
Check_existence.has_file "dune" content |
|
|
|
&& List.exists (fun p -> Fpath.has_ext ".ml" p) content |
|
|
|
then |
|
|
|
true |
|
|
|
else |
|
|
|
let contents = |
|
|
|
List.filter |
|
|
|
(fun x -> |
|
|
|
match Bos.OS.Dir.must_exist x with |
|
|
|
| Ok _p -> true |
|
|
|
| Error _e -> false ) |
|
|
|
content |
|
|
|
in |
|
|
|
let results = List.map check_dir_for_ml_and_dune contents in |
|
|
|
List.exists (fun x -> x) results |
|
|
|
match Bos.OS.Dir.contents ~dotfiles:true ~rel:true in_path with |
|
|
|
| Error _e -> false |
|
|
|
| Ok contents -> |
|
|
|
let content = contents in |
|
|
|
if |
|
|
|
Check_existence.has_file "dune" content |
|
|
|
&& List.exists (fun p -> Fpath.has_ext ".ml" p) content |
|
|
|
then |
|
|
|
true |
|
|
|
else |
|
|
|
let contents = |
|
|
|
List.filter |
|
|
|
(fun x -> |
|
|
|
match Bos.OS.Dir.must_exist x with |
|
|
|
| Ok _p -> true |
|
|
|
| Error _e -> false ) |
|
|
|
content |
|
|
|
in |
|
|
|
let results = List.map check_dir_for_ml_and_dune contents in |
|
|
|
List.exists (fun x -> x) results |
|
|
|
|
|
|
|
(** [check_dir_for_mld_and_dune in_path] takes a Fpath.t returns true if minimum |
|
|
|
requirements are met, false otherwise. *) |
|
|
|
let check_dir_for_mld_and_dune in_path = |
|
|
|
let content = |
|
|
|
match Bos.OS.Dir.contents ~dotfiles:true ~rel:true in_path with |
|
|
|
| Error _e -> |
|
|
|
Utils.error |
|
|
|
( "Cant list contents of subdirectory " ^ Fpath.to_string in_path |
|
|
|
^ ". (Check_directory.check_dir_for_ml_and_dune)" ) |
|
|
|
| Ok contents -> contents |
|
|
|
in |
|
|
|
Check_existence.has_file "dune" content |
|
|
|
&& Check_existence.has_file "index.mld" content |
|
|
|
match Bos.OS.Dir.contents ~dotfiles:true ~rel:true in_path with |
|
|
|
| Error _e -> false |
|
|
|
| Ok contents -> |
|
|
|
let content = contents in |
|
|
|
Check_existence.has_file "dune" content |
|
|
|
&& Check_existence.has_file "index.mld" content |
|
|
|
|
|
|
|
(** [minimum_requirement_of directory requirements] takes a directory, converts |
|
|
|
it to type [Fpath.t] and applies a given [requirements] function to it. *) |
|
|
|