Exadra37
Why is not compilation aborted when an undefined module attribute is found?
A bug going into production without any need:
warning: undefined module attribute @seconds, please remove access to @seconds or explicitly set it before access
lib/api_baas/accounts_admins/admin_user_token.ex:120: ApiBaas.AccountsAdmins.AdminUserToken (module)
Yes, tests should caught it, but why doesn’t the compiler abort compilation when it finds this?
Yes, I know that warnings can be enabled to behave as errors, but some warnings need to behave as warnings, and not halt the compiler.
I am curious about the reason for this to be considered as an warning and not an error?
Most Liked
al2o3cr
I only have 1.13 + OTP 25 right at hand to test, but on that version I still get the same warning from plug when running mix compile --warnings-as-errors with an empty _build directory.
However, --warnings-as-errors doesn’t turn warnings in dependencies into errors.
Some historical digging reveals that it used to; around the time of Elixir 1.4 that was changed, by commits like:
https://github.com/elixir-lang/elixir/commit/bc2480d53749ffbd102898f5ead7e0948aa860ae
hst337
Exadra37
For example:
==> plug
Compiling 1 file (.erl)
Compiling 41 files (.ex)
warning: System.stacktrace/0 is deprecated. Use __STACKTRACE__ instead
lib/plug/conn/wrapper_error.ex:26: Plug.Conn.WrapperError.reraise/3
==> ecto_sqlite3
Compiling 4 files (.ex)
warning: function query_many/4 required by behaviour Ecto.Adapters.SQL.Connection is not implemented (in module Ecto.Adapters.SQLite3.Connection)
lib/ecto/adapters/sqlite3/connection.ex:1: Ecto.Adapters.SQLite3.Connection (module)
Last Post!
Exadra37
Not a solution… at best a work-around and the problem persists for non informed developers.
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
- #forms
- #api
- #metaprogramming
- #hex
- #security









