Skip to content

CLI: Error on compiler warnings in tests (backport #12894) #12895

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

Merged
merged 5 commits into from
Dec 4, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Dec 4, 2024

This is similar to #10459 but focused on make instead. #10459 also only focused on warnings in lib/ files while this change causes CLI tests to fail when the test modules contain warnings. We need to add the --warnings-as-errors flag to mix test (added in Elixir 1.12). We can at the same time check that the lib/ files compile without warning by compiling with --warnings-as-errors as well.

Most compiler warnings fixed were benign. The shadowing diagnostics like unused bindings are useful though - one fix covered an unused binding that should've been a match (i.e. needed the pin operator ^).


This is an automatic backport of pull request #12894 done by Mergify.

the-mikedavis and others added 5 commits December 4, 2024 19:42
(cherry picked from commit d58d874)
This previously emitted a warning because Elixir will rebind `this_node`
by default, so the `this_node` binding in the line above was unused.
(As opposed to Erlang which would treat this as a match - rejecting
the binding if `this_node` was not equal to the value being matched.)
The node needed to be adjusted as well - `node()` returned the ExUnit
runner's node while the command returned the remote node, which is
stored in the context under `opts.node`.

(cherry picked from commit c328922)
This check is expected to succeed and the status is expected to be
printed to stdout rather than stderr. This change silences the status
output. The status text was printed mistakenly previously because we
captured stderr rather than stdout.

(cherry picked from commit 9f60325)
@michaelklishin michaelklishin added this to the 4.0.5 milestone Dec 4, 2024
@mergify mergify bot added the make label Dec 4, 2024
@the-mikedavis the-mikedavis merged commit 2afb29f into v4.0.x Dec 4, 2024
271 checks passed
@the-mikedavis the-mikedavis deleted the mergify/bp/v4.0.x/pr-12894 branch December 4, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants