Enable quokka with :module_directives rule

This commit is contained in:
Claudio Ortolina
2025-05-28 19:41:57 +01:00
parent 5207aa2773
commit 676c2e4290
52 changed files with 103 additions and 73 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
defmodule LastFm.API do
require Logger
alias LastFm.{Artist, Session, Track}
alias LastFm.API.{ErrorResponse, Signature}
alias LastFm.{Artist, Session, Track}
require Logger
def get_session(token, config) do
params =
+2 -2
View File
@@ -35,10 +35,10 @@ defmodule LastFm.Refresh do
use GenServer
require Logger
alias LastFm.{API, Config, Feed}
require Logger
@type config :: Config.t()
@spec start_link(config) :: GenServer.on_start()
+2 -2
View File
@@ -1,6 +1,4 @@
defmodule Mix.Tasks.Esbuild.CheckVersion do
use Mix.Task
@shortdoc "Checks the the current Esbuild version is the latest"
@moduledoc """
Checks the the current esbuild version is the latest.
@@ -8,6 +6,8 @@ defmodule Mix.Tasks.Esbuild.CheckVersion do
Exits with 0 if versions match, 1 if the esbuild needs to be updated.
"""
use Mix.Task
alias Mix.Tasks.Esbuild.Release
@impl Mix.Task
+2 -2
View File
@@ -1,11 +1,11 @@
defmodule Mix.Tasks.Esbuild.UpdateVersion do
use Mix.Task
@shortdoc "Update the configured esbuild versino to latest."
@moduledoc """
Update the configured esbuild versino to latest.
"""
use Mix.Task
alias Mix.Tasks.Esbuild.Release
@impl Mix.Task
@@ -1,11 +1,11 @@
defmodule Mix.Tasks.MusicBrainz.RefreshFixtures do
use Mix.Task
@shortdoc "Fetch and recreate test fixtures that depend on network resources."
@moduledoc """
Fetch and recreate test fixtures that depend on network resources.
"""
use Mix.Task
require Logger
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/music_brainz"])
@@ -1,5 +1,4 @@
defmodule Mix.Tasks.MusicLibrary.Prod.DbMigrate do
use Mix.Task
@shortdoc "Run migrations on the production database"
@moduledoc """
Run migrations on the production database.
@@ -7,6 +6,8 @@ defmodule Mix.Tasks.MusicLibrary.Prod.DbMigrate do
Requires the `flyctl` CLI to be installed and authenticated.
"""
use Mix.Task
import Mix.Tasks.MusicLibrary.Prod.Helpers
@impl Mix.Task
+2 -1
View File
@@ -1,11 +1,12 @@
defmodule Mix.Tasks.MusicLibrary.Prod.DbPull do
use Mix.Task
@shortdoc "Pulls the latest database from the production server"
@moduledoc """
Pulls the latest database from the production server.
Requires the `flyctl` CLI to be installed and authenticated.
"""
use Mix.Task
import Mix.Tasks.MusicLibrary.Prod.Helpers
@impl Mix.Task
@@ -1,5 +1,4 @@
defmodule Mix.Tasks.MusicLibrary.Prod.DbVacuum do
use Mix.Task
@shortdoc "Force VACUUM the production database"
@moduledoc """
Force VACUUM the production database. This is necessary to make sure that all
@@ -8,6 +7,8 @@ defmodule Mix.Tasks.MusicLibrary.Prod.DbVacuum do
Requires the `flyctl` CLI to be installed and authenticated.
"""
use Mix.Task
import Mix.Tasks.MusicLibrary.Prod.Helpers
@impl Mix.Task
+2 -1
View File
@@ -1,10 +1,11 @@
defmodule Mix.Tasks.MusicLibrary.Prod.Ping do
use Mix.Task
@shortdoc "Ping the production instance"
@moduledoc """
Ping the production instance - useful to wake it up if suspended.
"""
use Mix.Task
@impl Mix.Task
def run(_args) do
Application.ensure_all_started(:req)
+2 -2
View File
@@ -1,6 +1,4 @@
defmodule Mix.Tasks.Obsidian.Import do
use Mix.Task
@shortdoc "Import records from an Obsidian Vault containing Media entries "
@moduledoc """
Import records from an Obsidian Vault containing Media entries.
@@ -10,6 +8,8 @@ defmodule Mix.Tasks.Obsidian.Import do
`mix obsidian.import path/to/vault`
"""
use Mix.Task
@impl Mix.Task
def run(args) do
case args do
+2 -2
View File
@@ -1,6 +1,4 @@
defmodule Mix.Tasks.Tailwind.CheckVersion do
use Mix.Task
@shortdoc "Checks the the current Tailwind version is the latest"
@moduledoc """
Checks the the current Tailwind version is the latest.
@@ -8,6 +6,8 @@ defmodule Mix.Tasks.Tailwind.CheckVersion do
Exits with 0 if versions match, 1 if the Tailwind needs to be updated.
"""
use Mix.Task
alias Mix.Tasks.Tailwind.Release
@impl Mix.Task
+2 -2
View File
@@ -1,11 +1,11 @@
defmodule Mix.Tasks.Tailwind.UpdateVersion do
use Mix.Task
@shortdoc "Update the configured tailwind versino to latest."
@moduledoc """
Update the configured tailwind versino to latest.
"""
use Mix.Task
alias Mix.Tasks.Tailwind.Release
@impl Mix.Task
+2 -2
View File
@@ -6,10 +6,10 @@ defmodule MusicBrainz.API do
- Extend the metadata associated with existing records
"""
require Logger
alias MusicBrainz.{Artist, ReleaseGroupSearchResult, ReleaseSearchResult}
require Logger
@doc """
Uses the [lookup](https://musicbrainz.org/doc/MusicBrainz_API#Lookups) endpoint with the release group id and include the
associated artists, genres, releases and release group relations. Note that the API limits each included resource to 25 items.
@@ -1,9 +1,9 @@
defmodule MusicBrainz.ReleaseGroupSearchResult do
alias MusicBrainz.ReleaseGroup
@enforce_keys [:id, :type, :title, :artists, :release_date]
defstruct [:id, :type, :title, :artists, :release_date]
alias MusicBrainz.ReleaseGroup
def from_api_response(rg) do
%__MODULE__{
id: rg["id"],
+2 -2
View File
@@ -1,9 +1,9 @@
defmodule MusicBrainz.ReleaseSearchResult do
alias MusicBrainz.ReleaseGroup
@enforce_keys [:id, :title, :release_group, :artists, :date, :barcode, :media]
defstruct [:id, :title, :release_group, :artists, :date, :barcode, :media]
alias MusicBrainz.ReleaseGroup
def from_api_response(r) do
%__MODULE__{
id: r["id"],
+1 -1
View File
@@ -1,9 +1,9 @@
defmodule MusicLibrary.Artists do
import Ecto.Query, warn: false
alias MusicLibrary.Repo
alias MusicLibrary.Artists.ArtistInfo
alias MusicLibrary.Records.{ArtistRecord, Record}
alias MusicLibrary.Repo
alias MusicLibrary.{BackgroundRepo, Worker}
def get_artist!(musicbrainz_id) do
+1
View File
@@ -1,5 +1,6 @@
defmodule MusicLibrary.Artists.ArtistInfo do
use Ecto.Schema
import Ecto.Changeset
alias MusicLibrary.Records.Cover
+1 -2
View File
@@ -1,12 +1,11 @@
defmodule MusicLibrary.Collection do
import Ecto.Query, warn: false
import MusicLibrary.Records, only: [order_alphabetically: 0]
alias MusicLibrary.Records
alias MusicLibrary.Records.{Record, SearchIndex}
alias MusicLibrary.Repo
import MusicLibrary.Records, only: [order_alphabetically: 0]
def search_records(query, opts \\ []) do
limit = Keyword.get(opts, :limit, 20)
offset = Keyword.get(opts, :offset, 0)
+3 -2
View File
@@ -1,10 +1,11 @@
defmodule MusicLibrary.Records.Batch do
require Logger
import Ecto.Query
alias MusicLibrary.Records
alias MusicLibrary.Records.{Cover, Record}
alias MusicLibrary.Repo
import Ecto.Query
require Logger
def refresh_musicbrainz_data(opts \\ []) do
run_on_all_records(fn record ->
+1
View File
@@ -1,5 +1,6 @@
defmodule MusicLibrary.Records.Record do
use Ecto.Schema
import Ecto.Changeset
alias MusicBrainz.{Release, ReleaseGroup}
+1
View File
@@ -1,5 +1,6 @@
defmodule MusicLibrary.Secrets.Secret do
use Ecto.Schema
import Ecto.Changeset
@primary_key {:name, :string, autogenerate: false}
+5 -4
View File
@@ -23,10 +23,11 @@ defmodule MusicLibraryWeb do
quote do
use Phoenix.Router, helpers: false
# Import common connection and controller functions to use in pipelines
import Plug.Conn
import Phoenix.Controller
import Phoenix.LiveView.Router
# Import common connection and controller functions to use in pipelines
import Plug.Conn
end
end
@@ -76,7 +77,6 @@ defmodule MusicLibraryWeb do
def html do
quote do
use Phoenix.Component
use Gettext, backend: MusicLibraryWeb.Gettext
# Import convenience functions from controllers
@@ -91,10 +91,11 @@ defmodule MusicLibraryWeb do
defp html_helpers do
quote do
use Gettext, backend: MusicLibraryWeb.Gettext
import MusicLibraryWeb.CoreComponents
# HTML escaping functionality
import Phoenix.HTML
# Core UI components and translation
import MusicLibraryWeb.CoreComponents
# Shortcut for generating JS commands
alias Phoenix.LiveView.JS
+2 -1
View File
@@ -1,7 +1,8 @@
defmodule MusicLibraryWeb.Auth do
use Gettext, backend: MusicLibraryWeb.Gettext
import Plug.Conn
import Phoenix.Controller, only: [put_flash: 3, redirect: 2]
import Plug.Conn
def correct_login_password?(password) do
Plug.Crypto.secure_compare(login_password(), password)
@@ -15,9 +15,9 @@ defmodule MusicLibraryWeb.CoreComponents do
Icons are provided by [heroicons](https://heroicons.com). See `icon/1` for usage.
"""
use Phoenix.Component
use Gettext, backend: MusicLibraryWeb.Gettext
alias Phoenix.LiveView.JS
use Gettext, backend: MusicLibraryWeb.Gettext
defdelegate badge(assigns), to: Fluxon.Components.Badge
defdelegate button(assigns), to: Fluxon.Components.Button
@@ -1,12 +1,12 @@
defmodule MusicLibraryWeb.ArtistLive.Show do
use MusicLibraryWeb, :live_view
alias MusicLibrary.Artists.ArtistInfo
alias MusicLibrary.{Artists, Records}
import MusicLibraryWeb.RecordComponents,
only: [record_grid: 1, toggle_actions_menu: 1, close_actions_menu: 1, country_label: 1]
alias MusicLibrary.Artists.ArtistInfo
alias MusicLibrary.{Artists, Records}
attr :country, :map, required: true
defp country_flag(assigns) do
@@ -1,8 +1,9 @@
defmodule MusicLibraryWeb.CollectionLive.Index do
use MusicLibraryWeb, :live_view
import MusicLibraryWeb.BarcodeScannerComponent, only: [barcode_icon: 1]
import MusicLibraryWeb.PaginationComponent
import MusicLibraryWeb.RecordComponents
import MusicLibraryWeb.BarcodeScannerComponent, only: [barcode_icon: 1]
alias MusicLibrary.Collection
alias MusicLibrary.Records
@@ -1,8 +1,8 @@
defmodule MusicLibraryWeb.StatsLive.Index do
use MusicLibraryWeb, :live_view
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
import MusicLibraryWeb.ChartComponents
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
alias MusicLibrary.{Collection, Records, ScrobbleActivity, Wishlist}
@@ -1,5 +1,6 @@
defmodule MusicLibraryWeb.WishlistLive.Index do
use MusicLibraryWeb, :live_view
import MusicLibraryWeb.PaginationComponent
import MusicLibraryWeb.RecordComponents
+1
View File
@@ -76,6 +76,7 @@ defmodule MusicLibraryWeb.Router do
if Application.compile_env(:music_library, :monitoring_routes) do
use ErrorTracker.Web, :router
import Phoenix.LiveDashboard.Router
scope "/dev" do
+1
View File
@@ -1,5 +1,6 @@
defmodule MusicLibraryWeb.Telemetry do
use Supervisor
import Telemetry.Metrics
def start_link(arg) do