Disable detection of undefined-function-warnings partially on Elixir < 1.13

This commit is contained in:
Marcel Otto 2022-06-19 22:16:47 +02:00
parent 6109ec66e5
commit c58ffd383b
2 changed files with 18 additions and 10 deletions

View file

@ -26,6 +26,10 @@ jobs:
- pair:
elixir: 1.12.3
otp: 24.3
# Although Elixir 1.12 supports this feature, we're expecting errors since the code to suppress
# undefined-function-warnings on RDF.Graph.build blocks relies on Elixir 1.13 and is disabled
# partially on older versions.
no-warnings-as-errors: true
- pair:
elixir: 1.13.3
otp: 23.3

View file

@ -276,17 +276,21 @@ defmodule RDF.Graph.Builder do
String.to_atom(short)
end
defp extract_non_strict_ns(block) do
modules =
block
|> Macro.prewalker()
|> Enum.reduce([], fn
{:__aliases__, _, mod}, modules -> [Module.concat(mod) | modules]
_, modules -> modules
end)
|> Enum.uniq()
if Version.match?(System.version(), ">= 1.13.0") do
defp extract_non_strict_ns(block) do
modules =
block
|> Macro.prewalker()
|> Enum.reduce([], fn
{:__aliases__, _, mod}, modules -> [Module.concat(mod) | modules]
_, modules -> modules
end)
|> Enum.uniq()
for module <- modules, non_strict_vocab_namespace?(module), do: module
for module <- modules, non_strict_vocab_namespace?(module), do: module
end
else
defp extract_non_strict_ns(_), do: []
end
defp non_strict_vocab_namespace?(mod) do