Skip to content

Commit

Permalink
Merge branch 'main' into rewrite-file-sniffer-analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
angelikatyborska committed Jan 30, 2024
2 parents a3ee14f + 85c5356 commit 959e192
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/elixir_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -49,11 +49,11 @@ jobs:

- name: Retrieve PLT Cache

uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
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'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/elixir_test_external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
elixir 1.15.2-otp-26
erlang 26.0.2
elixir 1.16.0-otp-26
erlang 26.2.1
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions test/elixir_analyzer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
},
Expand Down
13 changes: 11 additions & 2 deletions test/support/exercise_test_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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. 📣"}
2 changes: 1 addition & 1 deletion test_data/two_fer/error_solution/expected_analysis.json
Original file line number Diff line number Diff line change
@@ -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. 🛠"}
{"comments":[{"comment":"elixir.general.parsing_error","params":{"error":"missing terminator: end","line":1},"type":"essential"}],"summary":"Check the comments for things to fix. 🛠"}

0 comments on commit 959e192

Please sign in to comment.