awful_waffle
Enabling --warnings-as-errors flag?
Hello!
I recently discovered the --warnings-as-errors flag and strongly prefer the workflow of being blocked by compiler warnings. Warnings in Elixir seem to be much more important (i.e. calls to undefined functions) than what I typically see as warnings in my experience with other languages (i.e. lint errors, unused variables).
I’m currently working through a Phoenix project but found that mix phx.server --warnings-as-errors was unrecognized. Is there a way to tell mix/Elixir to use --warnings-as-errors under the hood when running phx.server?
Thank you for your help!
Marked As Solved
hauleth
If you want to enable that flag by default you can use:
elixirc_options: [
:warnings_as_errors
]
Also Liked
fuelen
Hello!
--warnings-as-errors is a flag for mix compile.
What do you expect from --warnings-as-errors when running phx.server? Do not start server at all?
If so, then this command may help:
$ mix do compile --warnings-as-errors, phx.server
awful_waffle
Thanks for the responses!
Adding elixirc_options: [warnings_as_errors: true] to my project in mix.exs achieved my goal! Now warnings display as errors when I am working in Phoenix, which works great with live reload. If I start the server with an error, it fails to run - which is fine with me.
The only down side is that the warning itself is not printed to the browser - it just shows a generic compilation error screen. The console in which I ran mix phx.server still displays the rest of the information, at least. I assume there is a configuration setting somewhere to output those warnings to the web display, but for now I am happy.
Thank you again!
Last Post!
awful_waffle
Thanks for the responses!
Adding elixirc_options: [warnings_as_errors: true] to my project in mix.exs achieved my goal! Now warnings display as errors when I am working in Phoenix, which works great with live reload. If I start the server with an error, it fails to run - which is fine with me.
The only down side is that the warning itself is not printed to the browser - it just shows a generic compilation error screen. The console in which I ran mix phx.server still displays the rest of the information, at least. I assume there is a configuration setting somewhere to output those warnings to the web display, but for now I am happy.
Thank you again!
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









