File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
test/credo/check/readability Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,34 @@ defmodule Credo.Check.Readability.StrictModuleLayoutTest do
207207 |> refute_issues
208208 end
209209
210+ test "no errors are reported on a custom layout missing parts defined in :order" do
211+ """
212+ defmodule Test do
213+ def foo, do: :ok
214+ end
215+ """
216+ |> to_source_file
217+ |> run_check ( @ described_check , order: ~w/ public_fun private_fun/ a )
218+ |> refute_issues
219+ end
220+
221+ test "no errors are reported on a custom layout with extra parts not defined in :order" do
222+ """
223+ defmodule Test do
224+ def foo, do: :ok
225+
226+ defp bar, do: :ok
227+
228+ defmacro test, do: :ok
229+
230+ @moduledoc ""
231+ end
232+ """
233+ |> to_source_file
234+ |> run_check ( @ described_check , order: ~w/ public_fun private_fun/ a )
235+ |> refute_issues
236+ end
237+
210238 test "reports errors" do
211239 assert [ issue1 , issue2 ] =
212240 """
@@ -277,6 +305,31 @@ defmodule Credo.Check.Readability.StrictModuleLayoutTest do
277305 |> refute_issues
278306 end
279307
308+ test "no errors are reported on ignored parts for module attributes" do
309+ """
310+ defmodule Test do
311+ @type foo :: :foo
312+
313+ def hello do
314+ :world
315+ end
316+
317+ @foo :foo
318+
319+ @spec foo() :: foo()
320+ def foo() do
321+ @foo
322+ end
323+ end
324+ """
325+ |> to_source_file
326+ |> run_check ( @ described_check ,
327+ order: [ :moduledoc , :public_fun ] ,
328+ ignore: [ :type , :module_attribute ]
329+ )
330+ |> refute_issues
331+ end
332+
280333 test "reports errors on non-ignored parts" do
281334 [ issue ] =
282335 """
You can’t perform that action at this time.
0 commit comments