Bug: Honor ignored files before checking version
Describe the bug
When using .ocamlformat-ignore to ignore a directory, ocamlformat still checks the version of .ocamlformat files in this directory and fails if it's different.
How to Reproduce Steps to reproduce the behavior: Have this file structure:
- .ocamlformat-ignore
- .ocamlformat
- vendor/.ocamlformat
- vendor/a.ml
# .ocamlformat-ignore
vendor/**
# .ocamlformat
version=0.26.2
# vendor/.ocamlformat
version=0.27.0
Running ocamlformat (e.g. with dune fmt) fails:
File "vendor/.formatted/_unknown_", line 1, characters 0-0:
ocamlformat: Error while parsing <root directory>/_build/.sandbox/6d68df527a037d3db3fd364e008232ac/default/vendor/.ocamlformat:
Project should be formatted using ocamlformat version "0.27.0", but the installed version is "0.26.2"
I think the version check should only run on non-ignored directories.
Workaround
# .ocamlformat
version=0.26.2
version-check=false
But it no longer checks the ocamlformat version at the root either, which is not great.
I've been hitting the same issue. Is there any chance this gets fixed?
Does the issue with the configuration in vendored directories go away with (vendored_dirs ..) ? Doc: https://dune.readthedocs.io/en/stable/reference/dune/vendored_dirs.html
It does (as well as using (dirs :standard \ mysubdir)) but unfortunately, I can not use any of them for other reasons.
@Julow Using (vendored_dirs ..) is indeed another workaround solution, but with other potentially undesirable effects (e.g. dune test will ignore this directory).
I think the original issue remains valid. The version check should not run on ignored directories.
I think honoring ignored files before checking version is the right thing to do. Could you do it ?