Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when reporting errors in .eex files #1

Open
gshaw opened this issue Aug 13, 2019 · 0 comments

Comments

@gshaw
Copy link

commented Aug 13, 2019

I ran the tool against a project of mine and found a number of interesting insights. I definitely think this tool has merits and further work should be considered for it.

It crashed when reporting a violation in my email templates. (.eex) files. I fixed it by replacing the location method with

  defp location(error) do
    if error.file != nil and error.file != "" do
      prefix = "\n  "

      case error.position do
        # .eex error positions
        {path, position} ->
          "#{prefix}#{path}:#{position}\n"

        # .ex error positions
        _ ->
          "#{prefix}#{error.file}:#{error.position}\n"
      end
    else
      "\n"
    end
  end

Wasn't sure how to write a test for this so sharing what I have to get it reported and provide a work around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.