From a23f772c0431920dfee2b5bcf47d4dedf0d4d9ce Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Fri, 6 Mar 2026 10:08:25 +0000 Subject: [PATCH] Re-enable Credo CyclomaticComplexity check --- .credo.exs | 1 - lib/music_library_web/components/pagination.ex | 1 + lib/music_library_web/components/stats_components.ex | 1 + test/support/fixtures/scrobbled_tracks_fixtures.ex | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.credo.exs b/.credo.exs index 5ce2ec15..4ac3efca 100644 --- a/.credo.exs +++ b/.credo.exs @@ -7,7 +7,6 @@ {Credo.Check.Refactor.Nesting, max_nesting: 3} ], disabled: [ - {Credo.Check.Refactor.CyclomaticComplexity, []}, {Credo.Check.Readability.ModuleDoc, []} ] } diff --git a/lib/music_library_web/components/pagination.ex b/lib/music_library_web/components/pagination.ex index d68c01c3..d0e05f2b 100644 --- a/lib/music_library_web/components/pagination.ex +++ b/lib/music_library_web/components/pagination.ex @@ -186,6 +186,7 @@ defmodule MusicLibraryWeb.Components.Pagination do @visible_left_pages 3 @visible_right_pages 3 @middle "..." + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity defp generate_page_links(pagination_params) do %{ total_entries: total_entries, diff --git a/lib/music_library_web/components/stats_components.ex b/lib/music_library_web/components/stats_components.ex index 6ad453d0..bc150020 100644 --- a/lib/music_library_web/components/stats_components.ex +++ b/lib/music_library_web/components/stats_components.ex @@ -254,6 +254,7 @@ defmodule MusicLibraryWeb.StatsComponents do # The Tailwind build step requires all needed classes to be explicitly referenced # in the source code, and not dynamically generated. This implies that one cannot # (for example) interpolate a number in a class name. + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity defp stats_class(collection) do case Enum.count(collection) do 1 -> "grid-cols-1" diff --git a/test/support/fixtures/scrobbled_tracks_fixtures.ex b/test/support/fixtures/scrobbled_tracks_fixtures.ex index 8b3bec7c..05cf6d70 100644 --- a/test/support/fixtures/scrobbled_tracks_fixtures.ex +++ b/test/support/fixtures/scrobbled_tracks_fixtures.ex @@ -10,6 +10,7 @@ defmodule MusicLibrary.ScrobbledTracksFixtures do @doc """ Generate a scrobbled track. """ + # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity def track_fixture(attrs \\ %{}) do scrobbled_at_uts = attrs[:scrobbled_at_uts] || System.system_time(:second) - Enum.random(0..86_400)