diff options
author | Nick Vatamaniuc <vatamane@gmail.com> | 2022-06-27 17:25:46 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2022-06-30 11:19:15 -0400 |
commit | c605e04582e713120bde664b9ce51241ba9ff2e9 (patch) | |
tree | bcc1f9a0366ccb676b8c03b9d5cab9bb0a279fc0 | |
parent | b424ad12a7d5ee42b3cef00e6623c218730313e9 (diff) | |
download | couchdb-c605e04582e713120bde664b9ce51241ba9ff2e9.tar.gz |
Fix Elixir 13 compatibility
Elixir 13 is the only one which seems to work with Erlang 25.
But we can't use Elixir 13 because of a few compatibility issues so have to fix
this. That involves upgrading credo. However, as soon as credo was upgraded it
noticed a bunch of issues which also had to be fixed. Some of those were:
* Enum.map + join should be Enum.map_join
* Invalid module name in teardown `%___MODULE__` -> `%__MODULE__`
* `Mix.Config` is deprecated, use `Config`
* `db_test.ex` looks like a test module to credo, so renamed it, otherwise it has to have an .exs extension
* ibrowse had to be compiled so it could be properly analysed
Tested on macos (intel) with asdf installed elixir and erlang:
```
25.0.1 / 1.13.4-otp-25
24.3.4.1 / 1.13.4-otp-24
23.3.4.14 / 1.10.4-otp-23
```
-rw-r--r-- | config/config.exs | 4 | ||||
-rw-r--r-- | config/dev.exs | 2 | ||||
-rw-r--r-- | config/integration.exs | 2 | ||||
-rw-r--r-- | config/prod.exs | 2 | ||||
-rw-r--r-- | config/test.exs | 2 | ||||
-rw-r--r-- | mix.exs | 5 | ||||
-rw-r--r-- | mix.lock | 2 | ||||
-rw-r--r-- | src/dreyfus/test/elixir/test/test_helper.exs | 2 | ||||
-rw-r--r-- | test/elixir/config/config.exs | 2 | ||||
-rw-r--r-- | test/elixir/lib/couch/dbtest.ex (renamed from test/elixir/lib/couch/db_test.ex) | 0 | ||||
-rw-r--r-- | test/elixir/lib/step/start.ex | 4 | ||||
-rw-r--r-- | test/elixir/lib/suite.ex | 2 |
12 files changed, 14 insertions, 15 deletions
diff --git a/config/config.exs b/config/config.exs index 8e52433cc..2017bef44 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,6 +1,6 @@ # This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. -use Mix.Config +import Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this @@ -27,4 +27,4 @@ use Mix.Config # Configuration from the imported file will override the ones defined # here (which is why it is important to import them last). # -import_config "#{Mix.env}.exs"
\ No newline at end of file +import_config "#{Mix.env}.exs" diff --git a/config/dev.exs b/config/dev.exs index d2d855e6d..becde7693 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1 +1 @@ -use Mix.Config +import Config diff --git a/config/integration.exs b/config/integration.exs index 796880266..ef7fad226 100644 --- a/config/integration.exs +++ b/config/integration.exs @@ -1,4 +1,4 @@ -use Mix.Config +import Config config :logger, backends: [:console], diff --git a/config/prod.exs b/config/prod.exs index d2d855e6d..becde7693 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1 +1 @@ -use Mix.Config +import Config diff --git a/config/test.exs b/config/test.exs index c5a5ed24a..4e09e10a9 100644 --- a/config/test.exs +++ b/config/test.exs @@ -1,4 +1,4 @@ -use Mix.Config +import Config config :logger, backends: [:console], @@ -91,9 +91,8 @@ defmodule CouchDBTest.Mixfile do {:b64url, path: Path.expand("src/b64url", __DIR__)}, {:jiffy, path: Path.expand("src/jiffy", __DIR__)}, {:jwtf, path: Path.expand("src/jwtf", __DIR__)}, - {:ibrowse, - path: Path.expand("src/ibrowse", __DIR__), override: true, compile: false}, - {:credo, "~> 1.5.6", only: [:dev, :test, :integration], runtime: false} + {:ibrowse, path: Path.expand("src/ibrowse", __DIR__), override: true}, + {:credo, "~> 1.6.4", only: [:dev, :test, :integration], runtime: false} ] end @@ -1,7 +1,7 @@ %{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"}, - "credo": {:hex, :credo, "1.5.6", "e04cc0fdc236fefbb578e0c04bd01a471081616e741d386909e527ac146016c6", [:mix], [{:bunt, "~> 0.2.0", [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", "4b52a3e558bd64e30de62a648518a5ea2b6e3e5d2b164ef5296244753fc7eb17"}, + "credo": {:hex, :credo, "1.6.4", "ddd474afb6e8c240313f3a7b0d025cc3213f0d171879429bf8535d7021d9ad78", [:mix], [{:bunt, "~> 0.2.0", [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", "c28f910b61e1ff829bffa056ef7293a8db50e87f2c57a9b5c3f57eee124536b7"}, "excoveralls": {:hex, :excoveralls, "0.12.1", "a553c59f6850d0aff3770e4729515762ba7c8e41eedde03208182a8dc9d0ce07", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "5c1f717066a299b1b732249e736c5da96bb4120d1e55dc2e6f442d251e18a812"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "e0100f8ef7d1124222c11ad362c857d3df7cb5f4204054f9f0f4a728666591fc"}, diff --git a/src/dreyfus/test/elixir/test/test_helper.exs b/src/dreyfus/test/elixir/test/test_helper.exs index 6eb20e242..5f9c5833d 100644 --- a/src/dreyfus/test/elixir/test/test_helper.exs +++ b/src/dreyfus/test/elixir/test/test_helper.exs @@ -1,4 +1,4 @@ Code.require_file "../../../../couchdb/test/elixir/lib/couch.ex", __DIR__ Code.require_file "../../../../couchdb/test/elixir/test/test_helper.exs", __DIR__ Code.require_file "../../../../couchdb/test/elixir/test/support/couch_test_case.ex", __DIR__ -Code.require_file "../../../../couchdb/test/elixir/lib/couch/db_test.ex", __DIR__ +Code.require_file "../../../../couchdb/test/elixir/lib/couch/dbtest.ex", __DIR__ diff --git a/test/elixir/config/config.exs b/test/elixir/config/config.exs index 966ae83bb..c03362fca 100644 --- a/test/elixir/config/config.exs +++ b/test/elixir/config/config.exs @@ -1,6 +1,6 @@ # This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. -use Mix.Config +import Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this diff --git a/test/elixir/lib/couch/db_test.ex b/test/elixir/lib/couch/dbtest.ex index 652fa6bb6..652fa6bb6 100644 --- a/test/elixir/lib/couch/db_test.ex +++ b/test/elixir/lib/couch/dbtest.ex diff --git a/test/elixir/lib/step/start.ex b/test/elixir/lib/step/start.ex index ea7c70f5a..1be1cb1dc 100644 --- a/test/elixir/lib/step/start.ex +++ b/test/elixir/lib/step/start.ex @@ -59,7 +59,7 @@ defmodule Couch.Test.Setup.Step.Start do } end - def teardown(_setup, %___MODULE__{test_ctx: test_ctx}) do + def teardown(_setup, %__MODULE__{test_ctx: test_ctx}) do :test_util.stop_couch(test_ctx) end @@ -82,4 +82,4 @@ defmodule Couch.Test.Setup.Step.Start do for {x, _, _} <- Application.started_applications, do: x end -end
\ No newline at end of file +end diff --git a/test/elixir/lib/suite.ex b/test/elixir/lib/suite.ex index c30332cb2..4d625ee9b 100644 --- a/test/elixir/lib/suite.ex +++ b/test/elixir/lib/suite.ex @@ -61,7 +61,7 @@ defmodule Couch.Test.Suite do def pretty_print(tests) do tests = Enum.join(Enum.sort(Enum.map(tests, fn {module_name, test_names} -> test_names = test_names - |> Enum.map(fn x -> ~s("#{x}") end) |> Enum.join(",\n ") + |> Enum.map_join(fn x -> ~s("#{x}") end, ",\n ") ~s( "#{module_name}": [\n #{test_names}\n ]) end)), ",\n") "%{\n#{tests}\n}" |