Repository: hrzndhrn/recode (elixir)

Issue:
mix format fails with 0.6.1
Hello after updating to version `0.6.1` (from `0.5.1`) the command `mix format` started to fail with this error 
```elixir
** (UndefinedFunctionError) function Recode.Task.Format.config/1 is undefined or private
    (recode 0.6.1) Recode.Task.Format.config(:check)
    (recode 0.6.1) lib/recode/runner/impl.ex:174: anonymous fn/1 in Recode.Runner.Impl.tasks/3
    (elixir 1.15.5) lib/enum.ex:4393: Enum.reject_list/2
    (recode 0.6.1) lib/recode/runner/impl.ex:22: Recode.Runner.Impl.run/3
    (elixir 1.15.5) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
    (mix 1.15.5) lib/mix/tasks/format.ex:619: Mix.Tasks.Format.format_file/2
    (elixir 1.15.5) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
    (elixir 1.15.5) lib/task/supervised.ex:36: Task.Supervised.reply/4
```

Recode config was updated with `mix recode.gen.config` and command `mix recode` keeps working fine

Pull request:
Fix formatter plugin
closes #71 

Patch:
diff --git a/README.md b/README.md
index 96794f2..990b5fa 100644
--- a/README.md
+++ b/README.md
@@ -94,12 +94,12 @@ This mix task generates the config file `.recode.exs`.
   dry: false,
   # Can also be set/reset with `--verbose`/`--no-verbose`.
   verbose: false,
-  # Can be overwritten by calling `mix recode "lib/**/*.ex"`.
+  # Can be overwriten by calling `mix recode "lib/**/*.ex"`.
   inputs: ["{mix,.formatter}.exs", "{apps,config,lib,test}/**/*.{ex,exs}"],
   formatter: {Recode.Formatter, []},
   tasks: [
     # Tasks could be added by a tuple of the tasks module name and an options
-    # keyword list. A task can be deactivated by `active: false`. The execution of
+    # keyword list. A task can be deactived by `active: false`. The execution of
     # a deactivated task can be forced by calling `mix recode --task ModuleName`.
     {Recode.Task.AliasExpansion, []},
     {Recode.Task.AliasOrder, []},
@@ -214,7 +214,7 @@ Changed by: PipeFunOne
  File: lib/my_code/same_line.ex
 [Specs 2/3] Functions should have a @spec type specification.
 
- File: lib/my_code/single_pipe.ex
+ File: lib/my_code/singel_pipe.ex
 Updates: 1
 Changed by: SinglePipe
      ...|
@@ -271,7 +271,7 @@ Found 11 files, including 2 scripts.
  File: lib/my_code/pipe_fun_one.ex
 [PipeFunOne 7/7] Use parentheses for one-arity functions in pipes.
 
- File: lib/my_code/single_pipe.ex
+ File: lib/my_code/singel_pipe.ex
 [SinglePipe 7/7] Use a function call when a pipeline is only one function long.
 [SinglePipe 10/25] Use a function call when a pipeline is only one function long.
 
diff --git a/examples/my_code/.formatter.exs b/examples/my_code/.formatter.exs
index 9c2a193..db01a2c 100644
--- a/examples/my_code/.formatter.exs
+++ b/examples/my_code/.formatter.exs
@@ -1,6 +1,6 @@
 [
-  plugins: [],
-  # plugins: [Recode.FormatterPlugin],
+  # plugins: [],
+  plugins: [Recode.FormatterPlugin],
   # plugins: [FreedomFormatter],
   # plugins: [FreedomFormatter, Recode.FormatterPlugin],
   trailing_comma: true,
diff --git a/examples/my_code/.recode.exs b/examples/my_code/.recode.exs
index 587a919..931af26 100644
--- a/examples/my_code/.recode.exs
+++ b/examples/my_code/.recode.exs
@@ -8,12 +8,12 @@
   dry: false,
   # Can also be set/reset with `--verbose`/`--no-verbose`.
   verbose: false,
-  # Can be overwritten by calling `mix recode "lib/**/*.ex"`.
+  # Can be overwriten by calling `mix recode "lib/**/*.ex"`.
   inputs: ["{mix,.formatter}.exs", "{apps,config,lib,test}/**/*.{ex,exs}"],
   formatter: {Recode.Formatter, []},
   tasks: [
     # Tasks could be added by a tuple of the tasks module name and an options
-    # keyword list. A task can be deactivated by `active: false`. The execution of
+    # keyword list. A task can be deactived by `active: false`. The execution of
     # a deactivated task can be forced by calling `mix recode --task ModuleName`.
     {Recode.Task.AliasExpansion, []},
     {Recode.Task.AliasOrder, []},
@@ -30,4 +30,4 @@
     {Recode.Task.TestFileExt, []},
     {Recode.Task.UnusedVariable, [active: false]}
   ]
-]
+]
\ No newline at end of file
diff --git a/examples/my_code/lib/my_code/single_pipe.ex b/examples/my_code/lib/my_code/singel_pipe.ex
similarity index 100%
rename from examples/my_code/lib/my_code/single_pipe.ex
rename to examples/my_code/lib/my_code/singel_pipe.ex
diff --git a/examples/my_code/mix.lock b/examples/my_code/mix.lock
index 181c761..1952aa8 100644
--- a/examples/my_code/mix.lock
+++ b/examples/my_code/mix.lock
@@ -6,6 +6,6 @@
   "freedom_formatter": {:hex, :freedom_formatter, "2.1.0", "0578dce24ee370cfcd84306166fbf121b65e51482e7be7e96f4062982f929bfa", [:mix], [], "hexpm", "6522fd7f78214c48cfe7ff6d269a56819ec004a09cd1c08809a3ab895504ee01"},
   "glob_ex": {:hex, :glob_ex, "0.1.4", "fc69cb3f6df9138a1e36e9aa041ef2eab0d4dfe916331425f6bac290d1977e79", [:mix], [], "hexpm", "583d35559dc5b17f14612f7153aaaf6dcc13edf2e383126e2dfb5f2d19c78b89"},
   "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
-  "rewrite": {:hex, :rewrite, "0.7.1", "5dabe64ad359f0174e960f38684415ef0d80930e4811b59f149d251d23ae914f", [:mix], [{:glob_ex, "~> 0.1", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:sourceror, "~> 0.12.0", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "5667f23ff4d2c532c8ce8ec2dc5243c1ce13b45b4e3bd869e8162268f87543ef"},
-  "sourceror": {:hex, :sourceror, "0.12.3", "a2ad3a1a4554b486d8a113ae7adad5646f938cad99bf8bfcef26dc0c88e8fade", [:mix], [], "hexpm", "4d4e78010ca046524e8194ffc4683422f34a96f6b82901abbb45acc79ace0316"},
+  "rewrite": {:hex, :rewrite, "0.8.0", "31799e7a1f74cc0e3c3a18879d1cf3df4c4120560c621960b1784c40a081c1b8", [:mix], [{:glob_ex, "~> 0.1", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:sourceror, "~> 0.13", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "200df550432f0f1029d9dd28bc1578db032a61e71ea629b14d7ef5b97a6a8205"},
+  "sourceror": {:hex, :sourceror, "0.13.0", "c6ecc96ee3ae0e042e9082a9550a1989ea40182492dc29024a8d9d2b136e5014", [:mix], [], "hexpm", "d0a819491061cd26bfa4450d1c84301a410c19c1782a6577ce15853fc0e7e4e1"},
 }
diff --git a/lib/recode/config.ex b/lib/recode/config.ex
index 5196dd2..284f6ca 100644
--- a/lib/recode/config.ex
+++ b/lib/recode/config.ex
@@ -68,12 +68,12 @@ defmodule Recode.Config do
       dry: <%= @config[:dry] %>,
       # Can also be set/reset with `--verbose`/`--no-verbose`.
       verbose: <%= @config[:verbose] %>,
-      # Can be overwritten by calling `mix recode "lib/**/*.ex"`.
+      # Can be overwriten by calling `mix recode "lib/**/*.ex"`.
       inputs: <%= inspect @config[:inputs] %>,
       formatter: <%= inspect @config[:formatter] %>,
       tasks: [
         # Tasks could be added by a tuple of the tasks module name and an options
-        # keyword list. A task can be deactivated by `active: false`. The execution of
+        # keyword list. A task can be deactived by `active: false`. The execution of
         # a deactivated task can be forced by calling `mix recode --task ModuleName`.
         <%= for task <- @config[:tasks] do %><%= inspect task %>,
         <% end %>
diff --git a/lib/recode/runner/impl.ex b/lib/recode/runner/impl.ex
index ec9f342..1b7cd6a 100644
--- a/lib/recode/runner/impl.ex
+++ b/lib/recode/runner/impl.ex
@@ -159,7 +159,7 @@ defmodule Recode.Runner.Impl do
     |> Keyword.fetch!(:tasks)
     |> tasks(:active)
     |> tasks(:autocorrect, config[:autocorrect])
-    |> tasks(:check, config[:check])
+    |> tasks(:check, Keyword.get(config, :check, true))
   end
 
   defp tasks(tasks, :autocorrect, autocorrect) do
@@ -171,11 +171,11 @@ defmodule Recode.Runner.Impl do
 
   defp tasks(tasks, :check, false) do
     Enum.reject(tasks, fn {task, _opts} ->
-      task.config(:check) && !task.config(:correct)
+      Task.checker?(task) && !Task.corrector?(task)
     end)
   end
 
-  defp tasks(tasks, :check, _config), do: tasks
+  defp tasks(tasks, :check, true), do: tasks
 
   defp tasks(tasks, :active) do
     Enum.filter(tasks, fn {_task, config} -> Keyword.get(config, :active, true) end)


Test patch:
diff --git a/test/fixtures/config.exs b/test/fixtures/config.exs
index ea4c44c..8e98fe2 100644
--- a/test/fixtures/config.exs
+++ b/test/fixtures/config.exs
@@ -8,12 +8,12 @@
   dry: false,
   # Can also be set/reset with `--verbose`/`--no-verbose`.
   verbose: false,
-  # Can be overwritten by calling `mix recode "lib/**/*.ex"`.
+  # Can be overwriten by calling `mix recode "lib/**/*.ex"`.
   inputs: ["{mix,.formatter}.exs", "{apps,config,lib,test}/**/*.{ex,exs}"],
   formatter: {Recode.Formatter, []},
   tasks: [
     # Tasks could be added by a tuple of the tasks module name and an options
-    # keyword list. A task can be deactivated by `active: false`. The execution of
+    # keyword list. A task can be deactived by `active: false`. The execution of
     # a deactivated task can be forced by calling `mix recode --task ModuleName`.
     {Recode.Task.AliasExpansion, []},
     {Recode.Task.AliasOrder, []},
diff --git a/test/recode/runner/impl_test.exs b/test/recode/runner/impl_test.exs
index 696a9fa..fe621a1 100644
--- a/test/recode/runner/impl_test.exs
+++ b/test/recode/runner/impl_test.exs
@@ -40,6 +40,20 @@ defmodule Recode.Runner.ImplTest do
       end)
     end
 
+    test "runs tasks from config (check: false)", %{config: config} do
+      config =
+        Keyword.merge(config,
+          dry: true,
+          autocorrect: true,
+          check: false,
+          tasks: [{SinglePipe, []}]
+        )
+
+      capture_io(fn ->
+        assert %Rewrite{} = Runner.run(config)
+      end)
+    end
+
     test "runs task with the right config", %{config: config} do
       TaskMock
       |> expect(:run, fn source, config ->