Skip to content

Instantly share code, notes, and snippets.

@roehst
Created October 23, 2018 18:17
Show Gist options
  • Save roehst/24a676385415d8dbb72ff8ab2774cd22 to your computer and use it in GitHub Desktop.
Save roehst/24a676385415d8dbb72ff8ab2774cd22 to your computer and use it in GitHub Desktop.
Credo Bug On ABC
defmodule CredoBugOnABC do
"""
This is an interactive bug report :)
Load it on IEx.
"""
def test() do
code1 = ~s{
def foo(a, b) do
other_fun a, b
end
}
code2 = ~s{
def foo(a, b) do
other_fun
end
}
ast1 = Code.string_to_quoted! code1
ast2 = Code.string_to_quoted! code2
IO.puts "This is a bug report.\n"
IO.puts "The following code has a function call:"
IO.puts code1
abc1 = Credo.Check.Refactor.ABCSize.abc_size_for ast1
IO.puts "But its ABC size is measured as #{abc1}.\n"
IO.puts "In comparison, try the following code:"
IO.puts code2
abc2 = Credo.Check.Refactor.ABCSize.abc_size_for ast2
IO.puts "And its ABC size is measured correctly as #{abc2}.\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment