-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass --warn-error to Odoc with (env ..) #3029
Conversation
674c35b
to
8e89a0c
Compare
Just update the odoc conflict in the |
(cd _build/default/_doc/_html && %OPAM%/bin/odoc html --warn-error -I ../_odoc/pkg/bar -I ../../sub_env/lib/.bar.objs/byte -o . ../_odoc/pkg/bar/page-index.odoc) | ||
(cd _build/default/_doc/_html && %OPAM%/bin/odoc html -I ../_odoc/pkg/bar -I ../../sub_env/lib/.bar.objs/byte -o . ../../sub_env/lib/.bar.objs/byte/bar.odoc) | ||
(cd _build/default/_doc/_html && %OPAM%/bin/odoc html --warn-error -I ../_odoc/pkg/foo -I ../../lib/.foo.objs/byte -o . ../_odoc/pkg/foo/page-index.odoc) | ||
(cd _build/default/_doc/_html && %OPAM%/bin/odoc html --warn-error -I ../_odoc/pkg/foo -I ../../lib/.foo.objs/byte -o . ../../lib/.foo.objs/byte/foo.odoc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This output feels a bit too verbose. In order to convince ourselves that the test is passing, we have to go through it to check that --warn-error
is correctly passed where it should. What about actually leaving an odoc error and checking that it is reported as an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generating a warning from the odoc html
is not easy and Odoc is called from multiple independent paths in the source code and I wasn't convinced each paths had the correct environment.
Would it be better if I do both ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, by testing with an error in the source file, we are really testing the user-facing aspect of this PR, which is the most important.
If it's difficult to do that, we can keep the current way, but the output should be cleaned up more. Basically, a new reader should be able to look at the test and quickly understand what it is doing and whether it is passing or not. Otherwise, if some day this test breaks we might just accept the new output without realising the test is no longer passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the tests to show the actual output. I agree it looks a bit better.
869e469
to
5e70dd7
Compare
To fix the CI failure, look for I also prepared a PR to stop dune from printing command lines in tests (#3042). Once it's merged, you can rebase this PR and remove the |
And then run |
Alright, #3042 has just been merged |
5ff7e32
to
e74a23c
Compare
Just rebased and fixed the tests ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Is the version of odoc that supports |
It's not yet |
Ok. Let's way for odoc to be released then, and then we can update the odoc version constraint in Dune and merge this PR. |
| None -> | ||
let open Odoc in | ||
let default = | ||
(* DUNE3: Enable for dev profile in the future *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should apply only to the dev profile perhaps
It's a bit inconsistent that we have semantic fields for odoc but general |
This also needs an appropriate change list entry and a mention in the documentation. |
I added a bit of doc. Adding |
I see. Thanks for the explanation. |
f6637a4
to
1258af0
Compare
doc/documentation.rst
Outdated
``<optional-fields>`` are: | ||
|
||
- ``(warn-error <bool>)`` turns warnings into errors, if set to ``true``. | ||
This field is available since Dune 2.2 and requires Odoc 1.4.3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I'm not too sure about the warn-error
key. It mimics the option in odoc and the ocaml compilers, but maybe that part does not have to be exposed as is.
What do you think about (warnings fatal)
and (warnings nonfatal)
(or maybe (warnings display)
), which can be extended more easily to things like (warnings silenced)
if we decide to extend the feature later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just did that. I agree it looks better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mostly had a look at the doc, thanks!
65889f5
to
70d7d45
Compare
Sorry for the delay, Odoc 1.5.0 has been release 12 days ago. |
Could you update the odoc constraint in the dune-project file and .travis-ci.sh script, regenerate the opam file and rebase? Then this should be good to merge. |
197cffa
to
bf43f8c
Compare
bf43f8c
to
58dd4d8
Compare
I've update the PR, assuming the next release is |
Could you rebase again? That should fix the CI failure. |
58dd4d8
to
6122d5f
Compare
I've rebased the PR |
src/dune/odoc.ml
Outdated
let lib = | ||
let scope = Compilation_context.scope cctx in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted this change
b6a3df7
to
8597ad3
Compare
Allow to set the warnings mode for odoc compilation. Signed-off-by: Rudi Grinberg <me@rgrinberg.com> Signed-off-by: Jules Aguillon <juloo.dsi@gmail.com>
881c6eb
to
e6b360b
Compare
…lugin, dune-private-libs and dune-glob (2.4.0) CHANGES: - Add `mdx` extension and stanza version 0.1 (ocaml/dune#3094, @NathanReb) - Allow to make Odoc warnings fatal. This is configured from the `(env ...)` stanza. (ocaml/dune#3029, @Julow) - Fix separate compilation of JS when findlib is not installed. (ocaml/dune#3177, @nojb) - Add a `dune describe` command to obtain the topology of a dune workspace, for projects such as ROTOR. (ocaml/dune#3128, @diml) - Add `plugin` linking mode for executables and the `(embed_in_plugin_libraries ...)` field. (ocaml/dune#3141, @nojb) - Add an `%{ext_plugin}` variable (ocaml/dune#3141, @nojb) - Dune will no longer build shared objects for stubs if `supports_shared_libraries` is false (ocaml/dune#3225, fixes ocaml/dune#3222, @rgrinberg) - Fix a memory leak in the file-watching mode (`dune build -w`) (ocaml/dune#3220, @snowleopard and @aalekseyev)
Alternative PR to #3018
This PR adds a way to pass
--warn-error
to Odoc by adding a field to theenv
stanza:Warnings can be set to
fatal
ornonfatal
. They arenonfatal
by default (for now).Enabling this option and having an Odoc version that doesn't support it is an error. (no attempt is made to catch this)