From 01f7f1be67c03b42b2a79fa88b7c1b388ac22a6b Mon Sep 17 00:00:00 2001 From: Angelika Tyborska Date: Mon, 8 Jan 2024 06:17:37 +0100 Subject: [PATCH 1/2] Elixir 1.16 (#415) * Elixir 1.16 * Partially fix test problems * Do not double-stringify code * Undo commenting out tests * Continue reporting runtime warnings See https://github.com/elixir-lang/elixir/issues/13217 * Update elixir repo --- .github/workflows/elixir_test.yml | 4 ++-- .github/workflows/elixir_test_external.yml | 2 +- .tool-versions | 4 ++-- Dockerfile | 4 ++-- elixir | 2 +- .../common_checks/compiler_warnings.ex | 6 ++++++ mix.exs | 4 ++-- .../{chesboard_test.exs => chessboard_test.exs} | 0 test/elixir_analyzer_test.exs | 6 +++--- test/support/exercise_test_case.ex | 13 +++++++++++-- .../deprecated_modules/expected_analysis.json | 2 +- .../two_fer/error_solution/expected_analysis.json | 2 +- 12 files changed, 32 insertions(+), 17 deletions(-) rename test/elixir_analyzer/test_suite/{chesboard_test.exs => chessboard_test.exs} (100%) diff --git a/.github/workflows/elixir_test.yml b/.github/workflows/elixir_test.yml index 0bfe823c..42e9969a 100644 --- a/.github/workflows/elixir_test.yml +++ b/.github/workflows/elixir_test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-22.04 container: - image: hexpm/elixir:1.15.2-erlang-26.0.2-debian-bookworm-20230612 + image: hexpm/elixir:1.16.0-erlang-26.2.1-debian-bookworm-20231009 steps: - name: Install git @@ -53,7 +53,7 @@ jobs: id: plt-cache with: path: priv/plts - key: elixir:1.15.2-erlang-26.0.2-debian-bookworm-20230612-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-v3 + key: elixir:1.16.0-erlang-26.2.1-debian-bookworm-20231009-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-v3 - name: Create PLTs if: steps.plt-cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/elixir_test_external.yml b/.github/workflows/elixir_test_external.yml index 09b66df8..789bd39d 100644 --- a/.github/workflows/elixir_test_external.yml +++ b/.github/workflows/elixir_test_external.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-22.04 container: - image: hexpm/elixir:1.15.2-erlang-26.0.2-debian-bookworm-20230612 + image: hexpm/elixir:1.16.0-erlang-26.2.1-debian-bookworm-20231009 steps: - name: Install git diff --git a/.tool-versions b/.tool-versions index 15e68952..000a611a 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -elixir 1.15.2-otp-26 -erlang 26.0.2 \ No newline at end of file +elixir 1.16.0-otp-26 +erlang 26.2.1 diff --git a/Dockerfile b/Dockerfile index 059f1528..d181f649 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM hexpm/elixir:1.15.2-erlang-26.0.2-debian-bookworm-20230612 as builder +FROM hexpm/elixir:1.16.0-erlang-26.2.1-debian-bookworm-20231009 as builder RUN apt-get update && \ apt-get install bash -y @@ -13,7 +13,7 @@ COPY . . # Builds an escript bin/elixir_analyzer RUN ./bin/build.sh -FROM hexpm/elixir:1.15.2-erlang-26.0.2-debian-bookworm-20230612 +FROM hexpm/elixir:1.16.0-erlang-26.2.1-debian-bookworm-20231009 COPY --from=builder /etc/passwd /etc/passwd COPY --from=builder /elixir-analyzer/bin /opt/analyzer/bin diff --git a/elixir b/elixir index 63e38a1a..8d74999e 160000 --- a/elixir +++ b/elixir @@ -1 +1 @@ -Subproject commit 63e38a1ab90594a9e0eda48a558a81e7f0c3d1c3 +Subproject commit 8d74999e643302cd02057e32b51168f6d60e592c diff --git a/lib/elixir_analyzer/exercise_test/common_checks/compiler_warnings.ex b/lib/elixir_analyzer/exercise_test/common_checks/compiler_warnings.ex index e5296a2f..d1c4d527 100644 --- a/lib/elixir_analyzer/exercise_test/common_checks/compiler_warnings.ex +++ b/lib/elixir_analyzer/exercise_test/common_checks/compiler_warnings.ex @@ -47,6 +47,12 @@ defmodule ElixirAnalyzer.ExerciseTest.CommonChecks.CompilerWarnings do [_ | after_lib] = String.split(filepath, "/lib/") filepath = "lib/" <> Enum.join(after_lib) + line = + case line do + {line, col} when is_integer(line) and is_integer(col) -> "#{line}:#{col}" + line when is_integer(line) -> "#{line}" + end + """ warning: #{warning} #{filepath}:#{line} diff --git a/mix.exs b/mix.exs index 14904c13..e111094b 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ defmodule ElixirAnalyzer.MixProject do [ app: :elixir_analyzer, version: "0.1.0", - elixir: "~> 1.15", + elixir: "~> 1.16", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, # Turn off protocol consolidation to avoid warning in analyzed code @@ -57,6 +57,6 @@ defmodule ElixirAnalyzer.MixProject do defp elixirc_paths(_), do: ["lib"] defp escript do - [main_module: ElixirAnalyzer.CLI] + [main_module: ElixirAnalyzer.CLI, strip_beams: [keep: ["ExCk"]]] end end diff --git a/test/elixir_analyzer/test_suite/chesboard_test.exs b/test/elixir_analyzer/test_suite/chessboard_test.exs similarity index 100% rename from test/elixir_analyzer/test_suite/chesboard_test.exs rename to test/elixir_analyzer/test_suite/chessboard_test.exs diff --git a/test/elixir_analyzer_test.exs b/test/elixir_analyzer_test.exs index 3948858a..5c8f656b 100644 --- a/test/elixir_analyzer_test.exs +++ b/test/elixir_analyzer_test.exs @@ -109,8 +109,8 @@ defmodule ElixirAnalyzerTest do %{ "comment" => "elixir.general.parsing_error", "params" => %{ - "error" => "missing terminator: end (for \"do\" starting at line 1)", - "line" => 14 + "error" => "missing terminator: end", + "line" => 1 }, "type" => "essential" } @@ -290,7 +290,7 @@ defmodule ElixirAnalyzerTest do "comment" => "elixir.solution.compiler_warnings", "params" => %{ "warnings" => - "warning: Behaviour.defcallback/1 is deprecated. Use the @callback module attribute instead\n lib/lasagna.ex:4\n\nwarning: HashDict.new/0 is deprecated. Use maps and the Map module instead\n lib/lasagna.ex:7\n\nwarning: HashSet.member?/2 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12\n\nwarning: HashSet.new/0 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12\n\n" + "warning: Behaviour.defcallback/1 is deprecated. Use the @callback module attribute instead\n lib/lasagna.ex:4:13\n\nwarning: HashDict.new/0 is deprecated. Use maps and the Map module instead\n lib/lasagna.ex:7:14\n\nwarning: HashSet.member?/2 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12:13\n\nwarning: HashSet.new/0 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12:29\n\n" }, "type" => "actionable" }, diff --git a/test/support/exercise_test_case.ex b/test/support/exercise_test_case.ex index 37e053a1..f0f0582e 100644 --- a/test/support/exercise_test_case.ex +++ b/test/support/exercise_test_case.ex @@ -85,8 +85,17 @@ defmodule ElixirAnalyzer.ExerciseTestCase do {line, code} = case code do - {_, [line: line], _} -> {line, Macro.to_string(code)} - _ -> {__CALLER__.line, code} + {:sigil_S, opts, [{:<<>>, _, [inner_code]}, []]} when is_bitstring(inner_code) -> + {Keyword.get(opts, :line), inner_code} + + {_, opts, _} -> + {Keyword.get(opts, :line), Macro.to_string(code)} + + code when is_bitstring(code) -> + {__CALLER__.line, code} + + code -> + {__CALLER__.line, Macro.to_string(code)} end quote line: line do diff --git a/test_data/lasagna/deprecated_modules/expected_analysis.json b/test_data/lasagna/deprecated_modules/expected_analysis.json index 533d7368..ce50ddb9 100644 --- a/test_data/lasagna/deprecated_modules/expected_analysis.json +++ b/test_data/lasagna/deprecated_modules/expected_analysis.json @@ -1 +1 @@ -{"comments":[{"comment":"elixir.solution.compiler_warnings","params":{"warnings":"warning: Behaviour.defcallback/1 is deprecated. Use the @callback module attribute instead\n lib/lasagna.ex:4\n\nwarning: HashDict.new/0 is deprecated. Use maps and the Map module instead\n lib/lasagna.ex:7\n\nwarning: HashSet.member?/2 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12\n\nwarning: HashSet.new/0 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12\n\n"},"type":"actionable"},{"comment":"elixir.general.feedback_request","type":"informative"}],"summary":"Check the comments for some suggestions. 📣"} +{"comments":[{"comment":"elixir.solution.compiler_warnings","params":{"warnings":"warning: Behaviour.defcallback/1 is deprecated. Use the @callback module attribute instead\n lib/lasagna.ex:4:13\n\nwarning: HashDict.new/0 is deprecated. Use maps and the Map module instead\n lib/lasagna.ex:7:14\n\nwarning: HashSet.member?/2 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12:13\n\nwarning: HashSet.new/0 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12:29\n\n"},"type":"actionable"},{"comment":"elixir.general.feedback_request","type":"informative"}],"summary":"Check the comments for some suggestions. 📣"} diff --git a/test_data/two_fer/error_solution/expected_analysis.json b/test_data/two_fer/error_solution/expected_analysis.json index 78c75b51..da7dc966 100644 --- a/test_data/two_fer/error_solution/expected_analysis.json +++ b/test_data/two_fer/error_solution/expected_analysis.json @@ -1 +1 @@ -{"comments":[{"comment":"elixir.general.parsing_error","params":{"error":"missing terminator: end (for \"do\" starting at line 1)","line":14},"type":"essential"}],"summary":"Check the comments for things to fix. 🛠"} \ No newline at end of file +{"comments":[{"comment":"elixir.general.parsing_error","params":{"error":"missing terminator: end","line":1},"type":"essential"}],"summary":"Check the comments for things to fix. 🛠"} From 85c5356c98137fa88604fd874311605c84ecb168 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 06:13:25 +0100 Subject: [PATCH 2/2] Bump actions/cache from 3.3.2 to 4.0.0 (#417) Bumps [actions/cache](https://github.com/actions/cache) from 3.3.2 to 4.0.0. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/704facf57e6136b1bc63b828d79edcd491f0ee84...13aacd865c20de90d75de3b17ebe84f7a17d57d2) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/elixir_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/elixir_test.yml b/.github/workflows/elixir_test.yml index 42e9969a..2c810eb3 100644 --- a/.github/workflows/elixir_test.yml +++ b/.github/workflows/elixir_test.yml @@ -49,7 +49,7 @@ jobs: - name: Retrieve PLT Cache - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 id: plt-cache with: path: priv/plts