Guest User

Untitled

a guest
Oct 23rd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. defmodule CredoBugOnABC do
  2.  
  3. """
  4. This is an interactive bug report :)
  5.  
  6. Load it on IEx.
  7. """
  8.  
  9. def test() do
  10.  
  11. code1 = ~s{
  12. def foo(a, b) do
  13. other_fun a, b
  14. end
  15. }
  16.  
  17. code2 = ~s{
  18. def foo(a, b) do
  19. other_fun
  20. end
  21. }
  22.  
  23. ast1 = Code.string_to_quoted! code1
  24. ast2 = Code.string_to_quoted! code2
  25.  
  26. IO.puts "This is a bug report.\n"
  27.  
  28. IO.puts "The following code has a function call:"
  29. IO.puts code1
  30.  
  31. abc1 = Credo.Check.Refactor.ABCSize.abc_size_for ast1
  32. IO.puts "But its ABC size is measured as #{abc1}.\n"
  33.  
  34. IO.puts "In comparison, try the following code:"
  35. IO.puts code2
  36.  
  37. abc2 = Credo.Check.Refactor.ABCSize.abc_size_for ast2
  38. IO.puts "And its ABC size is measured correctly as #{abc2}.\n"
  39.  
  40. end
  41. end
Add Comment
Please, Sign In to add comment