1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283[@@@ocaml.text"/*"](** Copyright 2021-2025, Kakadu. *)(** SPDX-License-Identifier: LGPL-3.0-or-later *)[@@@ocaml.text"/*"]openDune_projectleton_module{impl;intf}=matchimpl,intfwith|None,None->failwith"Not implemented"|Somem,_whenString.(ends_with(lowercase_asciim)~suffix:"ast.ml")->()|None,Some_|Some_,Some_->()|Someml,None->letfilename=Config.recover_filepathmlinifnot(String.ends_with~suffix:".ml-gen"filename)thenCollected_lints.add~loc:Location.none(modulestructletmsgppffile=Format.fprintfppf"File '%s' doesn't have corresponding .mli interface"file;;lettxtppf()=Format.fprintfppf"%a\n"msgmlletrdjsonlppf()=letfilename=Config.recover_filepathmlinUtils.RDJsonl.ppppf~filename~line:1msgfilename;;end);;leton_library{Library.modules}=List.iteron_modulemodulesleton_executables{modules=_}=(* List.iter on_module modules *)();;letcheckdb=ifConfig.is_check_filesystem()thenList.iter(function|Build_context_|Root_->()|Executableses->on_executableses|Libraryl->on_libraryl)db;;letdocs={|
### What it does
Checks that dune project tree is well formed
### Why is is important?
All modules should have .mli interfaces.
The .mli files allow to
* hide some structure items
* write documentation for modules.
* hide dependencies between modules (i.e. speedup compilation)
Without .mli files all your functions will be 'public' in the sence of C++ style OOP.
Usually people autogenerate .mli files and all defined values in that time become public.
Zanuda is able to detect this via `zanuda -unused-decls .`.
But in some cases, .mli files may be too heavy, for example, when we write many type
declarations (sort of AST) with deriving attributes.
In that case .mli file is almost identical to .ml.
To workaround this, this check allows file with a suffix `ast.ml` not to have an .mli interface file.
TODO: Add custom configuration for this.
|}|>Stdlib.String.trim;;letlint_id="lint_filesystem"letdescribe_as_json()=Utils.describe_as_clippy_jsonlint_id~docs