diff --git a/lib/excoveralls/cobertura.ex b/lib/excoveralls/cobertura.ex index c4405d85..0b13330f 100644 --- a/lib/excoveralls/cobertura.ex +++ b/lib/excoveralls/cobertura.ex @@ -159,14 +159,15 @@ defmodule ExCoveralls.Cobertura do end defp module_name(source) do - case Regex.run(~r/^def(?:module|protocol|impl)\s+(.*)\s+do$/m, source, capture: :all_but_first) do + cond do + # Is it an elixir module? + [module] = Regex.run(~r/^def(?:module|protocol|impl)\s+(.*)\s+do$/m, source, capture: :all_but_first) -> module - [module] -> - module + # Is it an erlang module? + [module] = Regex.run(~r/^-module\((.*)\)\.$/m, source, capture: :all_but_first) -> module - _ -> - [module] = Regex.run(~r/^-(?:module|protocol|impl)\((.*)\)\.$/m, source, capture: :all_but_first) - module + # Something else? + true -> "Unknown module" end end