From c608744307253fce367c7c0ff388239cfad3849d Mon Sep 17 00:00:00 2001 From: Guilherme Andrade Date: Sun, 29 Oct 2023 17:54:37 +0000 Subject: [PATCH] Don't break builds of our dependents if new warnings appear We limit warnings-as-errors to the Mix test env, which still ensures tests will fail (and CI) if there are warnings. GitHub issue: * https://github.com/sqids/sqids-elixir/issues/7 --- CHANGELOG.md | 5 +++++ mix.exs | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73b2531..83f34a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `new!/0` and `new!/1` to ease storing context in module attributes +### Fixed + +- unwarranted risk of new future warnings breaking the builds of sqids + dependents + ## [0.1.0] - 2023-10-28 ### Added diff --git a/mix.exs b/mix.exs index 49ac6bb..5939b56 100644 --- a/mix.exs +++ b/mix.exs @@ -5,17 +5,17 @@ defmodule Sqids.MixProject do @source_url "https://github.com/sqids/sqids-elixir" def project do + mix_env = Mix.env() + [ app: :sqids, version: @version, description: description(), elixir: "~> 1.7", - start_permanent: Mix.env() === :prod, + start_permanent: mix_env === :prod, deps: deps(), - elixirc_paths: elixirc_paths(Mix.env()), - elixirc_options: [ - warnings_as_errors: true - ], + elixirc_paths: elixirc_paths(mix_env), + elixirc_options: elixirc_options(mix_env), docs: docs(), test_coverage: [ summary: [ @@ -75,6 +75,14 @@ defmodule Sqids.MixProject do end end + defp elixirc_options(env) do + if env === :test do + [warnings_as_errors: true] + else + [] + end + end + defp docs do [ main: "readme",