• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

exercism / elixir-analyzer / 81bb2bd44c91598e28b337a76394d2632f36db5b

29 Sep 2025 12:19AM UTC coverage: 98.524%. Remained the same
81bb2bd44c91598e28b337a76394d2632f36db5b

push

github

web-flow
Add analyzer for gotta-snatch-em-all (#451)

* Add analyzer for gotta-snatch-em-all

* Fix space alignment & formatting

* Add tests for gotta snatch em all analyzer

* Fix wording & spelling mistakes

Co-authored-by: Jie <jie.gillet@gmail.com>

---------

Co-authored-by: Jie <jie.gillet@gmail.com>

868 of 881 relevant lines covered (98.52%)

16232.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.44
/lib/elixir_analyzer/exercise_test/common_checks/compiler_warnings.ex
1
defmodule ElixirAnalyzer.ExerciseTest.CommonChecks.CompilerWarnings do
2
  @moduledoc """
3
  This is an exercise analyzer extension module used for capturing compiler warnings
4
  """
5
  alias ElixirAnalyzer.Constants
6
  alias ElixirAnalyzer.Comment
7

8
  def run(code_path) do
9
    Logger.configure(level: :critical)
1,019✔
10

11
    warnings =
1,019✔
12
      case Kernel.ParallelCompiler.compile(code_path) do
13
        {:ok, modules, warnings} ->
14
          Enum.each(modules, fn module ->
1,019✔
15
            :code.delete(module)
23✔
16
            :code.purge(module)
23✔
17
          end)
18

19
          warnings
1,019✔
20

21
        {:error, _errors, _warnings} ->
×
22
          # This should not happen, as real code is assumed to have compiled and
23
          # passed the tests
24
          []
25
      end
26

27
    Logger.configure(level: :warning)
1,019✔
28

29
    Application.put_env(:elixir, :ansi_enabled, true)
1,019✔
30

31
    if Enum.empty?(warnings) do
1,019✔
32
      []
33
    else
34
      [
35
        {:fail,
36
         %Comment{
37
           type: :actionable,
38
           name: Constants.solution_compiler_warnings(),
39
           comment: Constants.solution_compiler_warnings(),
40
           params: %{warnings: warnings |> Enum.sort() |> Enum.map_join(&format_warning/1)}
41
         }}
42
      ]
43
    end
44
  end
45

46
  defp format_warning({filepath, line, warning}) do
47
    [_ | after_lib] = String.split(filepath, "/lib/")
6✔
48
    filepath = "lib/" <> Enum.join(after_lib)
6✔
49

50
    line =
6✔
51
      case line do
52
        {line, col} when is_integer(line) and is_integer(col) -> "#{line}:#{col}"
4✔
53
        line when is_integer(line) -> "#{line}"
2✔
54
      end
55

56
    """
6✔
57
    warning: #{warning}
6✔
58
      #{filepath}:#{line}
6✔
59

60
    """
61
  end
62
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc