   end
 
   defp do_run([], _, _, _), do: :noop
+
   defp do_run(files, opts, project, source_paths) do
-    include_path = to_erl_file project[:erlc_include_path]
-    compile_path = to_erl_file Mix.Project.compile_path(project)
+    include_path = to_erl_file(project[:erlc_include_path])
+    compile_path = to_erl_file(Mix.Project.compile_path(project))
 
     erlc_options = project[:erlc_options] || []
+
     unless is_list(erlc_options) do
-      Mix.raise ":erlc_options should be a list of options, got: #{inspect(erlc_options)}"
-    end
+      Mix.raise(":erlc_options should be a list of options, got: #{inspect(erlc_options)}")
+    end
+
     erlc_options = erlc_options ++ [:return, :report, outdir: compile_path, i: include_path]
-    erlc_options = Enum.map erlc_options, fn
-      {kind, dir} when kind in [:i, :outdir] ->
-        {kind, to_erl_file(dir)}
-      opt ->
-        opt
-    end
-
-    compile_path = Path.relative_to(compile_path, File.cwd!)
-
-    tuples = files
-             |> scan_sources(include_path, source_paths)
-             |> sort_dependencies
-             |> Enum.map(&annotate_target(&1, compile_path, opts[:force]))
-
-    Mix.Compilers.Erlang.compile(manifest(), tuples, opts, fn
-      input, _output ->
-        # We're purging the module because a previous compiler (e.g. Phoenix)
-        # might have already loaded the previous version of it.
-        module = Path.basename(input, ".erl") |> String.to_atom
-        :code.purge(module)
-        :code.delete(module)
-
-        file = to_erl_file(Path.rootname(input, ".erl"))
-        case :compile.file(file, erlc_options) do
-          {:error, :badarg} ->
-            Mix.raise "Compiling Erlang #{inspect file} failed with ArgumentError, probably because of invalid :erlc_options"
-          result ->
-            result
-        end
+
+    erlc_options =
+      Enum.map(erlc_options, fn
+        {kind, dir} when kind in [:i, :outdir] -> {kind, to_erl_file(dir)}
+        opt -> opt
+      end)
+
+    compile_path = Path.relative_to(compile_path, File.cwd!())
+
+    tuples =
+      files
+      |> scan_sources(include_path, source_paths)
+      |> sort_dependencies()
+      |> Enum.map(&annotate_target(&1, compile_path, opts[:force]))
+
+    Mix.Compilers.Erlang.compile(manifest(), tuples, opts, fn input, _output ->
+      # We're purging the module because a previous compiler (e.g. Phoenix)
+      # might have already loaded the previous version of it.
+      module = input |> Path.basename(".erl") |> String.to_atom()
+      :code.purge(module)
+      :code.delete(module)
+
+      file = to_erl_file(Path.rootname(input, ".erl"))
+
+      case :compile.file(file, erlc_options) do
+        {:error, :badarg} ->
+          message =
+            "Compiling Erlang #{inspect(file)} failed with ArgumentError, probably because of invalid :erlc_options"
+
+          Mix.raise(message)
+
+        result ->
+          result
+      end
     end)
   end
 

  Returns Erlang manifests.
  """
  def manifests, do: [manifest()]
  defp manifest, do: Path.join(Mix.Project.manifest_path, @manifest)

  @doc """
  Cleans up compilation artifacts.

  """
  def run(args) do
    {opts, _, _} = OptionParser.parse(args, switches: @switches)
    project = Mix.Project.config()
    source_paths = project[:erlc_paths]
    Mix.Compilers.Erlang.assert_valid_erlc_paths(source_paths)
    files = Mix.Utils.extract_files(source_paths, [:erl])
