From 7906b9633690bb56881444f0d3b25e597f6c4d75 Mon Sep 17 00:00:00 2001 From: Randy Coulman Date: Tue, 9 Jan 2024 20:57:42 -0800 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20to=20Elixir=201.?= =?UTF-8?q?16=20(#134)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ⬆️ Upgrade to Elixir 1.16 Elixir 1.11 is no longer supported, so remove from the CI matrix. Update Credo to get some 1.16 fixes, which required disabling credo in a few places that now trigger false-positive rule violations. The functions in question are inlined in the `config-v6` branch, so this temporary override will go away soon. * 🎨 Fix formatting issues There were apparently some minor changes in Elixir 1.16's formatter. --- .github/workflows/elixir-ci.yml | 9 ++------- .tool-versions | 2 +- lib/config_cat/cache_policy.ex | 2 +- lib/config_cat/hooks.ex | 2 +- lib/config_cat/rollout/comparator.ex | 9 +++++++++ mix.exs | 2 +- mix.lock | 4 ++-- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/elixir-ci.yml b/.github/workflows/elixir-ci.yml index 4b4a1ac9..27356adc 100644 --- a/.github/workflows/elixir-ci.yml +++ b/.github/workflows/elixir-ci.yml @@ -12,7 +12,7 @@ on: workflow_dispatch: env: - ELIXIR_VERSION: '1.15.x' + ELIXIR_VERSION: '1.16.x' OTP_VERSION: '24.x' jobs: @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - elixir-version: ['1.11.x', '1.12.x', '1.13.x', '1.14.x', '1.15.x'] + elixir-version: ['1.12.x', '1.13.x', '1.14.x', '1.15.x', '1.16.x'] steps: - uses: actions/checkout@v2 - name: Set up Elixir @@ -57,12 +57,7 @@ jobs: - name: Run dialyzer run: mix dialyzer - - name: Execute tests (Elixir 1.11.x) - if: matrix.elixir-version == '1.11.x' - run: mix coveralls.json - - name: Execute tests - if: matrix.elixir-version != '1.11.x' run: mix coveralls.json --warnings-as-errors - name: Upload coverage report diff --git a/.tool-versions b/.tool-versions index 302a28eb..08216bb2 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -elixir 1.15.7-otp-26 +elixir 1.16.0-otp-26 erlang 26.2 diff --git a/lib/config_cat/cache_policy.ex b/lib/config_cat/cache_policy.ex index 6e11024f..d08fe24b 100644 --- a/lib/config_cat/cache_policy.ex +++ b/lib/config_cat/cache_policy.ex @@ -55,7 +55,7 @@ defmodule ConfigCat.CachePolicy do @type lazy_options :: [{:cache_refresh_interval_seconds, non_neg_integer()}] @typedoc "Callback to call when configuration changes." - @type on_changed_callback :: (() -> :ok) + @type on_changed_callback :: (-> :ok) @typedoc false @type option :: diff --git a/lib/config_cat/hooks.ex b/lib/config_cat/hooks.ex index eb6e318a..9f09918d 100644 --- a/lib/config_cat/hooks.ex +++ b/lib/config_cat/hooks.ex @@ -77,7 +77,7 @@ defmodule ConfigCat.Hooks do ``` """ @type named_callback :: {module(), atom(), list()} - @type on_client_ready_callback :: (() -> any()) | named_callback() + @type on_client_ready_callback :: (-> any()) | named_callback() @type on_config_changed_callback :: (Config.settings() -> any()) | named_callback() @type on_error_callback :: (String.t() -> any()) | named_callback() @type on_flag_evaluated_callback :: (EvaluationDetails.t() -> any()) | named_callback() diff --git a/lib/config_cat/rollout/comparator.ex b/lib/config_cat/rollout/comparator.ex index 3ccf392e..db55c366 100644 --- a/lib/config_cat/rollout/comparator.ex +++ b/lib/config_cat/rollout/comparator.ex @@ -113,6 +113,9 @@ defmodule ConfigCat.Rollout.Comparator do {:ok, false} end + # These aren't actually predicates, but are inlined in the `config-v6` branch + # so will go away soon. + # credo:disable-for-next-line Credo.Check.Readability.PredicateFunctionNames defp is_one_of(user_value, comparison_value) do result = comparison_value @@ -128,6 +131,9 @@ defmodule ConfigCat.Rollout.Comparator do {:ok, result} end + # These aren't actually predicates, but are inlined in the `config-v6` branch + # so will go away soon. + # credo:disable-for-next-line Credo.Check.Readability.PredicateFunctionNames defp is_one_of_semver(user_value, comparison_value) do user_version = Version.parse!(user_value) @@ -145,6 +151,9 @@ defmodule ConfigCat.Rollout.Comparator do {:error, error} end + # These aren't actually predicates, but are inlined in the `config-v6` branch + # so will go away soon. + # credo:disable-for-next-line Credo.Check.Readability.PredicateFunctionNames defp is_one_of_sensitive(user_value, comparison_value) do user_value |> hash_value() diff --git a/mix.exs b/mix.exs index d4ebc87f..ba88878f 100644 --- a/mix.exs +++ b/mix.exs @@ -10,7 +10,7 @@ defmodule ConfigCat.MixProject do source_url: @source_url, homepage_url: "https://configcat.com/", version: "3.0.0", - elixir: "~> 1.10", + elixir: "~> 1.12", description: description(), package: package(), elixirc_options: elixirc_options(Mix.env()), diff --git a/mix.lock b/mix.lock index 3d9cd678..9a1dfe60 100644 --- a/mix.lock +++ b/mix.lock @@ -1,7 +1,7 @@ %{ - "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"}, - "credo": {:hex, :credo, "1.7.1", "6e26bbcc9e22eefbff7e43188e69924e78818e2fe6282487d0703652bc20fd62", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e9871c6095a4c0381c89b6aa98bc6260a8ba6addccf7f6a53da8849c748a58a2"}, + "credo": {:hex, :credo, "1.7.3", "05bb11eaf2f2b8db370ecaa6a6bda2ec49b2acd5e0418bc106b73b07128c0436", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "35ea675a094c934c22fb1dca3696f3c31f2728ae6ef5a53b5d648c11180a4535"}, "dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"}, "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, "elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"},