Extending merlin by plugins?

It would be wonderful to be able to extend merlin/ocaml-lsp by various plugins which will perform various analyses, like

  • general linter to confuse students, for example, " don’t use List.length to check emptyness"
  • specific linter related to libraries (for example, which proposes rewriting using monad laws, if it is correct)
  • CWE checking, etc.

What do you think?


Not exactly what you were asking for, but semgrep offers a general framework to do this. It actually includes the rule you mention: semgrep-rules/list.yaml at release · returntocorp/semgrep-rules · GitHub. Although the default OCaml rule set is not too extensive, so you end up writing your own rules as well, which is actually useful for project-specific or teaching-specific things.

1 Like

I was thinking of something like that for ocamllsp, but I think a linter is achievable by just writing a ppx and merlin will automatically support it

1 Like

Nope, I want linting of typed tree

I don’t mean to say a plugin system wouldn’t be useful, but for now you could also extend how ocamllsp computes diagnostics and add your own linting rules