-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add warnings as errors for ex_doc #8596
Add warnings as errors for ex_doc #8596
Conversation
CT Test Results 5 files 191 suites 2h 11m 6s ⏱️ For more details on these failures, see this check. Results for commit 75913d7. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
make/ex_doc_wrapper.in
Outdated
@@ -4,7 +4,7 @@ ARGS=("$@") | |||
|
|||
set -eo pipefail {0} | |||
|
|||
EX_DOC=$(command -v ex_doc) | |||
EX_DOC=$(command -v ex_doc || true) |
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 am getting "Could not find ex_doc!" because this is overriding EX_DOC
.
EX_DOC=${EX_DOC:=$(command -v ex_doc || true)}
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 just realized you are basically using EX_DOC
to point to the wrapper.
Best case for the nix derivations is I can just define which EX_DOC to use directly and thread that into the wrapper.
@@ -15,7 +15,7 @@ if [ -z "${EX_DOC}" ]; then | |||
if $ERL_TOP/otp_build download_ex_doc; then | |||
read -p "Press any key to continue..." -n 1 -r | |||
echo "continuing" | |||
EX_DOC=$(command -v ex_doc) | |||
EX_DOC=$(command -v ex_doc || true) |
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 think this is fine because EX_DOC wouldn't have been defined previously
Made some comments. Feel free to tag me if you want me to test again. Really appreciate you helping me with this! (I don't expect you to do this) If for some reason you want to test yourself my branch is here https://github.com/chiroptical/nixpkgs/tree/test-ex-doc-updates. You would need nix and then run |
af8fd65
to
80e418e
Compare
New attempt, you should be able to set |
@@ -151,7 +151,7 @@ current_datetime = System.os_time() |> DateTime.from_unix!(:native) | |||
config = [ | |||
proglang: :erlang, | |||
source_url_pattern: source_url_pattern, | |||
assets: Path.join(cwd, "/assets"), | |||
assets: %{ Path.join(cwd, "/assets") => "assets" }, |
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.
Next error I get from the nix build
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell) or set the ELIXIR_ERL_OPTIONS="+fnu" environment variable
** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1
The following arguments were given to IO.chardata_to_string/1:
# 1
%{"/build/source/lib/stdlib/doc/assets" => "assets"}
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.
stack trace
(elixir 1.16.3) lib/io.ex:687: IO.chardata_to_string/1
(elixir 1.16.3) lib/path.ex:662: Path.join/2
(ex_doc 0.32.1) lib/ex_doc/formatter/html.ex:294: ExDoc.Formatter.HTML.copy_assets/2
(ex_doc 0.32.1) lib/ex_doc/formatter/html.ex:288: ExDoc.Formatter.HTML.generate_assets/3
(ex_doc 0.32.1) lib/ex_doc/formatter/html.ex:25: ExDoc.Formatter.HTML.run/3
(ex_doc 0.32.1) lib/ex_doc/cli.ex:69: anonymous fn/6 in ExDoc.CLI.generate/3
(elixir 1.16.3) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.16.3) lib/kernel/cli.ex:136: anonymous fn/3 in Kernel.CLI.exec_fun/2
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 guess this comes from https://github.com/elixir-lang/ex_doc/blob/v0.34.0/CHANGELOG.md#v0340-2024-05-30? i.e. I think this requires a specific version of ex_doc now. Unsure if that is intended?
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.
We will always require a specific version of ex_doc, which one is listed in https://github.com/erlang/otp/blob/master/make/ex_doc_vsn
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.
Ahh, okay! Let me update that and keep testing thanks!
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.
There are some bugs in v0.34.0 of ex_doc that cause some issues, so you may have to wait for v0.35.0 in order for everything to pass.
@garazdawi as you may know we have an open PR that adds |
@@ -52,15 +52,17 @@ else | |||
DOC_TARGETS?=html | |||
endif | |||
|
|||
EX_DOC_WARNINGS_AS_ERRORS?=true |
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.
Last question, should this be false by default?
I immediately had to turn it off in the nix build. Which worked by the way! Here is the simplification I was able to do with this https://github.com/chiroptical/nixpkgs/pull/4/files.
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.
No I want it to be on by default as there should never be any warnings if you use the correct ExDoc vsn.
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 get this from the build with that set to true.
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell) or set the ELIXIR_ERL_OPTIONS="+fnu" environment variable
I guess you may want to set this in the wrapper then?
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.
That would be something that needs fixing in nix I think. The Erlang VM thinks that filenames should be encoded in latin1 because the locale is not set to utf8.
The elixir nix package seems to set LANG and LC_TYPE to C.UTF-8
which should do the trick.
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 guess so! Really appreciate you looking through all this.
@wojtekmach I would be happy to use a built-in ex_doc warnings as errors. I did this PR because a bunch of warnings slipped trough in Erlang/OTP and it did not seem like there was much interest in getting elixir-lang/ex_doc#1831 merged anytime soon. |
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.
From my standpoint, it looks great!
We check the output of ex_doc to see if there are any warnings emitted and if there are then we exit the build.
80e418e
to
75913d7
Compare
This PR adds a mechanism to scan the stderr output from ex_doc for warnings and if found fail the build.