Skip to content

Fix compilation warnings on modern Elixir#40

Open
gilbertwong96 wants to merge 1 commit into
dwyl:masterfrom
gilbertwong96:fix/compile-warnings
Open

Fix compilation warnings on modern Elixir#40
gilbertwong96 wants to merge 1 commit into
dwyl:masterfrom
gilbertwong96:fix/compile-warnings

Conversation

@gilbertwong96

@gilbertwong96 gilbertwong96 commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Resolves all compilation warnings emitted when building this project on modern Elixir/OTP. Verified with mix compile --warnings-as-errors on Elixir 1.20 / OTP 29.

Changes

  • config/config.exs — Replace deprecated use Mix.Config with import Config (the Mix.Config macro has been deprecated since Elixir 1.11).
  • lib/mix/tasks/pre_commit.ex — Replace module-body Application.get_env/2 calls with Application.compile_env/3, supplying the previous || default fallback as the third argument. Reading config at compile time via compile_env/3 is the recommended pattern and eliminates the "discouraged in the module body" warning.
  • mix.exs — Bump required Elixir from ~> 1.2 to ~> 1.16. The previous constraint was older than the ~> 1.16 value already documented in the @moduledoc, and ~> 1.2 no longer resolves cleanly on current Elixir releases.
  • mix.lock — Refresh transitive deps (ex_doc, earmark_parser, makeup, makeup_elixir, makeup_erlang, nimble_parsec) that mix deps pulled in for the build.

Verification

$ rm -rf _build/dev/lib/pre_commit
$ mix compile
Compiling 2 files (.ex)
Generated pre_commit app

$ mix compile --warnings-as-errors
# (no output, exits 0)

Notes

  • The only remaining warnings on a clean mix compile come from inside deps (makeup, ex_doc) and are out of scope for this change.
  • Behaviour of the pre_commit Mix task and the git pre-commit hook is unchanged — this is a refactor / build hygiene PR.

Test plan

  • mix compile runs clean with no project warnings
  • mix compile --warnings-as-errors exits 0
  • Manual: drop a pre_commit config into a host project, commit a change, confirm pre-commit task still runs commands and halts correctly

- config/config.exs: replace deprecated use Mix.Config with import Config
- lib/mix/tasks/pre_commit.ex: replace Application.get_env/2 at module
  body with Application.compile_env/3, supplying a default as the third
  argument
- mix.exs: bump required Elixir version from ~> 1.2 to ~> 1.16, matching
  the value already documented in the @moduledoc and required to compile
  against modern Elixir/OTP
- mix.lock: refresh transitive deps pulled in by mix deps
@gilbertwong96 gilbertwong96 force-pushed the fix/compile-warnings branch from c2da5df to 5c65398 Compare June 16, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant