Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 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-24.04

container:
image: hexpm/elixir:1.18.1-erlang-27.2-debian-bookworm-20241223
image: hexpm/elixir:1.19.4-erlang-28.1-debian-bookworm-20251117

steps:
- name: Install git
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
id: plt-cache
with:
path: priv/plts
key: elixir:1.18.1-erlang-27.2-debian-bookworm-20241223-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-v3
key: elixir:1.19.4-erlang-28.1-debian-bookworm-20251103-${{ 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-24.04

container:
image: hexpm/elixir:1.18.1-erlang-27.2-debian-bookworm-20241223
image: hexpm/elixir:1.19.4-erlang-28.1-debian-bookworm-20251117

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.18.1-otp-27
erlang 27.2
elixir 1.19.4-otp-28
erlang 28.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.18.1-erlang-27.2-debian-bookworm-20241223 as builder
FROM hexpm/elixir:1.19.4-erlang-28.1-debian-bookworm-20251117 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.18.1-erlang-27.2-debian-bookworm-20241223
FROM hexpm/elixir:1.19.4-erlang-28.1-debian-bookworm-20251117
COPY --from=builder /etc/passwd /etc/passwd

COPY --from=builder /elixir-analyzer/bin /opt/analyzer/bin
Expand Down
2 changes: 1 addition & 1 deletion elixir
Submodule elixir updated 76 files
+13 −33 .github/workflows/ci.yml
+1 −1 .github/workflows/pr-comment.yml
+0 −12 .lycheeignore
+1 −1 README.md
+1 −1 concepts/access-behaviour/about.md
+1 −1 concepts/default-arguments/about.md
+9 −0 concepts/mapsets/.meta/config.json
+83 −0 concepts/mapsets/about.md
+83 −0 concepts/mapsets/introduction.md
+6 −0 concepts/mapsets/links.json
+1 −1 concepts/multiple-clause-functions/links.json
+75 −14 config.json
+70 −0 exercises/concept/gotta-snatch-em-all/.docs/hints.md
+100 −0 exercises/concept/gotta-snatch-em-all/.docs/instructions.md
+85 −0 exercises/concept/gotta-snatch-em-all/.docs/introduction.md
+3 −0 exercises/concept/gotta-snatch-em-all/.docs/introduction.md.tpl
+4 −0 exercises/concept/gotta-snatch-em-all/.formatter.exs
+24 −0 exercises/concept/gotta-snatch-em-all/.gitignore
+21 −0 exercises/concept/gotta-snatch-em-all/.meta/config.json
+50 −0 exercises/concept/gotta-snatch-em-all/.meta/design.md
+72 −0 exercises/concept/gotta-snatch-em-all/.meta/exemplar.ex
+44 −0 exercises/concept/gotta-snatch-em-all/lib/gotta_snatch_em_all.ex
+27 −0 exercises/concept/gotta-snatch-em-all/mix.exs
+333 −0 exercises/concept/gotta-snatch-em-all/test/gotta_snatch_em_all_test.exs
+2 −0 exercises/concept/gotta-snatch-em-all/test/test_helper.exs
+23 −0 exercises/practice/binary-search-tree/.docs/instructions.md
+84 −0 exercises/practice/camicia/.docs/instructions.md
+24 −0 exercises/practice/camicia/.docs/introduction.md
+4 −0 exercises/practice/camicia/.formatter.exs
+24 −0 exercises/practice/camicia/.gitignore
+19 −0 exercises/practice/camicia/.meta/config.json
+150 −0 exercises/practice/camicia/.meta/example.ex
+94 −0 exercises/practice/camicia/.meta/tests.toml
+24 −0 exercises/practice/camicia/lib/camicia.ex
+28 −0 exercises/practice/camicia/mix.exs
+1,432 −0 exercises/practice/camicia/test/camicia_test.exs
+2 −0 exercises/practice/camicia/test/test_helper.exs
+2 −1 exercises/practice/clock/.meta/config.json
+3 −2 exercises/practice/clock/lib/clock.ex
+1 −1 exercises/practice/dot-dsl/.docs/instructions.md
+55 −22 exercises/practice/dot-dsl/test/dot_test.exs
+1 −1 exercises/practice/eliuds-eggs/.docs/introduction.md
+26 −0 exercises/practice/flower-field/.docs/instructions.md
+7 −0 exercises/practice/flower-field/.docs/introduction.md
+4 −0 exercises/practice/flower-field/.formatter.exs
+35 −0 exercises/practice/flower-field/.meta/config.json
+57 −0 exercises/practice/flower-field/.meta/example.ex
+46 −0 exercises/practice/flower-field/.meta/tests.toml
+9 −0 exercises/practice/flower-field/lib/flower_field.ex
+28 −0 exercises/practice/flower-field/mix.exs
+199 −0 exercises/practice/flower-field/test/flower_field_test.exs
+2 −0 exercises/practice/flower-field/test/test_helper.exs
+2 −2 exercises/practice/intergalactic-transmission/.docs/instructions.md
+23 −0 exercises/practice/intergalactic-transmission/.gitignore
+1 −1 exercises/practice/killer-sudoku-helper/.docs/instructions.md
+10 −0 exercises/practice/largest-series-product/.meta/tests.toml
+25 −20 exercises/practice/luhn/.docs/instructions.md
+2 −2 exercises/practice/luhn/.docs/introduction.md
+1 −1 exercises/practice/meetup/.docs/instructions.md
+1 −1 exercises/practice/phone-number/.docs/instructions.md
+20 −27 exercises/practice/protein-translation/.docs/instructions.md
+12 −12 exercises/practice/relative-distance/.docs/instructions.md
+1 −1 exercises/practice/relative-distance/.docs/introduction.md
+8 −44 exercises/practice/say/.docs/instructions.md
+6 −0 exercises/practice/say/.docs/introduction.md
+26 −52 exercises/practice/simple-cipher/.docs/instructions.md
+1 −1 exercises/practice/simple-cipher/.meta/config.json
+6 −0 exercises/practice/triangle/.docs/instructions.md
+7 −0 exercises/practice/two-bucket/.meta/tests.toml
+24 −0 exercises/practice/two-bucket/test/two_bucket_test.exs
+16 −0 exercises/practice/variable-length-quantity/.meta/tests.toml
+45 −0 exercises/practice/variable-length-quantity/test/variable_length_quantity_test.exs
+22 −3 exercises/practice/wordy/.meta/tests.toml
+20 −0 exercises/practice/wordy/test/wordy_test.exs
+4 −3 mix.exs
+3 −3 mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ defmodule ElixirAnalyzer.ExerciseTest.CommonChecks.CompilerWarnings do
Logger.configure(level: :critical)

warnings =
case Kernel.ParallelCompiler.compile(code_path) do
{:ok, modules, warnings} ->
case Kernel.ParallelCompiler.compile(code_path, return_diagnostics: true) do
{:ok, modules,
%{
runtime_warnings: runtime_warnings,
compile_warnings: compile_warnings
}} ->
Enum.each(modules, fn module ->
:code.delete(module)
:code.purge(module)
end)

warnings
compile_warnings ++ runtime_warnings

{:error, _errors, _warnings} ->
# This should not happen, as real code is assumed to have compiled and
Expand All @@ -43,7 +47,7 @@ defmodule ElixirAnalyzer.ExerciseTest.CommonChecks.CompilerWarnings do
end
end

defp format_warning({filepath, line, warning}) do
defp format_warning(%{file: filepath, position: line, message: warning}) do
[_ | after_lib] = String.split(filepath, "/lib/")
filepath = "lib/" <> Enum.join(after_lib)

Expand Down
15 changes: 8 additions & 7 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@ defmodule ElixirAnalyzer.MixProject do
[
app: :elixir_analyzer,
version: "0.1.0",
elixir: "~> 1.18",
elixir: "~> 1.19",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
# Turn off protocol consolidation to avoid warning in analyzed code
consolidate_protocols: false,
deps: deps(),
escript: escript(),
preferred_cli_env: [
# run dialyzer in test env so that files in test/support also get checked
dialyzer: :test
],
dialyzer: [
plt_core_path: "priv/plts",
plt_file: {:no_warn, "priv/plts/eventstore.plt"}
Expand All @@ -36,6 +32,11 @@ defmodule ElixirAnalyzer.MixProject do
]
end

def cli do
# run dialyzer in test env so that files in test/support also get checked
[preferred_envs: [dialyzer: :test]]
end

# Run "mix help compile.app" to learn about applications.
def application do
[
Expand All @@ -47,8 +48,8 @@ defmodule ElixirAnalyzer.MixProject do
defp deps do
[
{:jason, "~> 1.2"},
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4.7", runtime: false},
{:excoveralls, "~> 0.14", only: :test}
]
end
Expand Down
8 changes: 4 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
%{
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hexpm", "6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea"},
"credo": {:hex, :credo, "1.7.10", "6e64fe59be8da5e30a1b96273b247b5cf1cc9e336b5fd66302a64b25749ad44d", [: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", "71fbc9a6b8be21d993deca85bf151df023a3097b01e09a2809d460348561d8cd"},
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"},
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
"credo": {:hex, :credo, "1.7.13", "126a0697df6b7b71cd18c81bc92335297839a806b6f62b61d417500d1070ff4e", [: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", "47641e6d2bbff1e241e87695b29f617f1a8f912adea34296fb10ecc3d7e9e84f"},
"dialyxir": {:hex, :dialyxir, "1.4.7", "dda948fcee52962e4b6c5b4b16b2d8fa7d50d8645bbae8b8685c3f9ecb7f5f4d", [:mix], [{:erlex, ">= 0.2.8", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b34527202e6eb8cee198efec110996c25c5898f43a4094df157f8d28f27d9efe"},
"erlex": {:hex, :erlex, "0.2.8", "cd8116f20f3c0afe376d1e8d1f0ae2452337729f68be016ea544a72f767d9c12", [:mix], [], "hexpm", "9d66ff9fedf69e49dc3fd12831e12a8a37b76f8651dd21cd45fcf5561a8a7590"},
"excoveralls": {:hex, :excoveralls, "0.18.3", "bca47a24d69a3179951f51f1db6d3ed63bca9017f476fe520eb78602d45f7756", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "746f404fcd09d5029f1b211739afb8fb8575d775b21f6a3908e7ce3e640724c6"},
"file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"},
"file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"},
"hackney": {:hex, :hackney, "1.18.1", "c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f", [:rebar3], [{:certifi, "~>2.8.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "9afcda620704d720db8c6a3123e9848d09c87586dc1c10479c42627b905b5c5e"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
Expand Down
Empty file removed priv/plts/.keep
Empty file.
14 changes: 1 addition & 13 deletions test/elixir_analyzer/test_suite/gotta_snatch_em_all_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,13 @@ defmodule ElixirAnalyzer.ExerciseTest.GottSnatchEmAllTest do

@spec split_shiny_cards(collection()) :: {[card()], [card()]}
def split_shiny_cards(collection) do
{shiny, not_shiny} = split_with(collection, &String.starts_with?(&1, "Shiny"))
{shiny, not_shiny} = MapSet.split_with(collection, &String.starts_with?(&1, "Shiny"))

shiny_list = shiny |> MapSet.to_list() |> Enum.sort()
not_shiny_list = not_shiny |> MapSet.to_list() |> Enum.sort()

{shiny_list, not_shiny_list}
end

defp split_with(mapset, predicate) do
init = {MapSet.new(), MapSet.new()}

Enum.reduce(mapset, init, fn item, {passes, fails} ->
if predicate.(item) do
{MapSet.put(passes, item), fails}
else
{passes, MapSet.put(fails, item)}
end
end)
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/support/analyzer_verification/check_source.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ defmodule ElixirAnalyzer.Support.AnalyzerVerification.CheckSource do
comment "module is not formatted"

check(%Source{code_string: code_string}) do
String.trim(code_string) == Code.format_string!(code_string) |> Enum.join()
String.trim(code_string) == Code.format_string!(code_string)
end
end

Expand Down