Skip to content

Commit

Permalink
Cobertura, catch all if module type is unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
gorghoa committed Mar 21, 2023
1 parent a001090 commit 689d136
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/excoveralls/cobertura.ex
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,12 @@ 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

[module] ->
module

_ ->
[module] = Regex.run(~r/^-(?:module|protocol|impl)\((.*)\)\.$/m, source, capture: :all_but_first)
module
end
with nil <- Regex.run(~r/^def(?:module|protocol|impl)\s+(.*)\s+do$/m, source, capture: :all_but_first),
nil <- Regex.run(~r/^-module\((.*)\)\.$/m, source, capture: :all_but_first) do
"UNKNOWN_MODULE"
else
[module] -> module
end
end

defp package_name(path, c_paths) do
Expand Down

0 comments on commit 689d136

Please sign in to comment.