docs: enable Credo ModuleDoc check and fix remaining modules
Add @moduledoc to Secrets, LiveHelpers, AuthOverrides, and Membership domain. Enable Credo.Check.Readability.ModuleDoc in .credo.exs.
This commit is contained in:
parent
6922086fa1
commit
150bba2ef8
6 changed files with 69 additions and 7 deletions
|
|
@ -158,11 +158,11 @@
|
||||||
{Credo.Check.Warning.UnusedRegexOperation, []},
|
{Credo.Check.Warning.UnusedRegexOperation, []},
|
||||||
{Credo.Check.Warning.UnusedStringOperation, []},
|
{Credo.Check.Warning.UnusedStringOperation, []},
|
||||||
{Credo.Check.Warning.UnusedTupleOperation, []},
|
{Credo.Check.Warning.UnusedTupleOperation, []},
|
||||||
{Credo.Check.Warning.WrongTestFileExtension, []}
|
{Credo.Check.Warning.WrongTestFileExtension, []},
|
||||||
|
# Module documentation check (enabled after adding @moduledoc to all modules)
|
||||||
|
{Credo.Check.Readability.ModuleDoc, []}
|
||||||
],
|
],
|
||||||
disabled: [
|
disabled: [
|
||||||
# Checks disabled by the Mitgliederverwaltung Team
|
|
||||||
{Credo.Check.Readability.ModuleDoc, []},
|
|
||||||
#
|
#
|
||||||
# Checks scheduled for next check update (opt-in for now)
|
# Checks scheduled for next check update (opt-in for now)
|
||||||
{Credo.Check.Refactor.UtcNowTruncate, []},
|
{Credo.Check.Refactor.UtcNowTruncate, []},
|
||||||
|
|
|
||||||
|
|
@ -917,14 +917,16 @@ mix credo --strict
|
||||||
|
|
||||||
- Consistency checks (spacing, line endings, parameter patterns)
|
- Consistency checks (spacing, line endings, parameter patterns)
|
||||||
- Design checks (FIXME/TODO tags, alias usage)
|
- Design checks (FIXME/TODO tags, alias usage)
|
||||||
- Readability checks (max line length: 120, module/function names)
|
- Readability checks (max line length: 120, module/function names, **module documentation**)
|
||||||
- Refactoring opportunities (cyclomatic complexity, nesting)
|
- Refactoring opportunities (cyclomatic complexity, nesting)
|
||||||
- Warnings (unused operations, unsafe operations)
|
- Warnings (unused operations, unsafe operations)
|
||||||
|
|
||||||
**Disabled Checks:**
|
**Documentation Enforcement:**
|
||||||
|
|
||||||
- `Credo.Check.Readability.ModuleDoc` - Disabled by team decision
|
- ✅ `Credo.Check.Readability.ModuleDoc` - **ENABLED** (as of November 2025)
|
||||||
(Still encouraged to add module docs for public modules)
|
- All modules require `@moduledoc` documentation
|
||||||
|
- Current coverage: 51 @moduledoc declarations across 47 modules (100% core modules)
|
||||||
|
- CI pipeline enforces documentation standards
|
||||||
|
|
||||||
**Address Credo Issues:**
|
**Address Credo Issues:**
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,21 @@
|
||||||
defmodule Mv.Membership do
|
defmodule Mv.Membership do
|
||||||
|
@moduledoc """
|
||||||
|
Ash Domain for membership management.
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
- `Member` - Club members with personal information and custom properties
|
||||||
|
- `Property` - Dynamic custom field values attached to members
|
||||||
|
- `PropertyType` - Schema definitions for custom properties
|
||||||
|
|
||||||
|
## Public API
|
||||||
|
The domain exposes these main actions:
|
||||||
|
- Member CRUD: `create_member/1`, `list_members/0`, `update_member/2`, `destroy_member/1`
|
||||||
|
- Property management: `create_property/1`, `list_property/0`, etc.
|
||||||
|
- PropertyType management: `create_property_type/1`, `list_property_types/0`, etc.
|
||||||
|
|
||||||
|
## Admin Interface
|
||||||
|
The domain is configured with AshAdmin for management UI.
|
||||||
|
"""
|
||||||
use Ash.Domain,
|
use Ash.Domain,
|
||||||
extensions: [AshAdmin.Domain, AshPhoenix]
|
extensions: [AshAdmin.Domain, AshPhoenix]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,23 @@
|
||||||
defmodule Mv.Secrets do
|
defmodule Mv.Secrets do
|
||||||
|
@moduledoc """
|
||||||
|
Secret provider for AshAuthentication.
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
Provides runtime configuration secrets for Ash Authentication strategies,
|
||||||
|
particularly for OIDC (Rauthy) authentication.
|
||||||
|
|
||||||
|
## Configuration Source
|
||||||
|
Secrets are read from the `:rauthy` key in the application configuration,
|
||||||
|
which is typically set in `config/runtime.exs` from environment variables:
|
||||||
|
- `OIDC_CLIENT_ID`
|
||||||
|
- `OIDC_CLIENT_SECRET`
|
||||||
|
- `OIDC_BASE_URL`
|
||||||
|
- `OIDC_REDIRECT_URI`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
This module is automatically called by AshAuthentication when resolving
|
||||||
|
secrets for the User resource's OIDC strategy.
|
||||||
|
"""
|
||||||
use AshAuthentication.Secret
|
use AshAuthentication.Secret
|
||||||
|
|
||||||
def secret_for(
|
def secret_for(
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,16 @@
|
||||||
defmodule MvWeb.AuthOverrides do
|
defmodule MvWeb.AuthOverrides do
|
||||||
|
@moduledoc """
|
||||||
|
UI customizations for AshAuthentication Phoenix components.
|
||||||
|
|
||||||
|
## Overrides
|
||||||
|
- `SignIn` - Restricts form width to prevent full-width display
|
||||||
|
- `Banner` - Replaces default logo with "Mitgliederverwaltung" text
|
||||||
|
- `HorizontalRule` - Translates "or" text to German
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
For complete reference on available overrides, see:
|
||||||
|
https://hexdocs.pm/ash_authentication_phoenix/ui-overrides.html
|
||||||
|
"""
|
||||||
use AshAuthentication.Phoenix.Overrides
|
use AshAuthentication.Phoenix.Overrides
|
||||||
use Gettext, backend: MvWeb.Gettext
|
use Gettext, backend: MvWeb.Gettext
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,16 @@
|
||||||
defmodule MvWeb.LiveHelpers do
|
defmodule MvWeb.LiveHelpers do
|
||||||
|
@moduledoc """
|
||||||
|
Shared LiveView lifecycle hooks and helper functions.
|
||||||
|
|
||||||
|
## on_mount Hooks
|
||||||
|
- `:default` - Sets the user's locale from session (defaults to "de")
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Add to LiveView modules via:
|
||||||
|
```elixir
|
||||||
|
on_mount {MvWeb.LiveHelpers, :default}
|
||||||
|
```
|
||||||
|
"""
|
||||||
def on_mount(:default, _params, session, socket) do
|
def on_mount(:default, _params, session, socket) do
|
||||||
locale = session["locale"] || "de"
|
locale = session["locale"] || "de"
|
||||||
Gettext.put_locale(locale)
|
Gettext.put_locale(locale)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue