Small refactoring #360

Merged
moritz merged 9 commits from refactor into main 2026-01-20 17:59:24 +01:00
Owner

1. Domain Public API Documentation Incomplete

Problem: The @moduledoc in domain modules does not list all public functions.

Affected Files:

  • lib/membership/membership.ex - Missing functions in Public API:
    • list_required_custom_fields/0
    • update_member_field_visibility/2
    • update_single_member_field_visibility/3
  • lib/accounts/accounts.ex - Very short Public API documentation, could be more detailed
  • lib/membership_fees/membership_fees.ex - Public API is complete, but could more clearly document that LiveViews use direct Ash calls

Priority: Low (Documentation, no functionality affected)

Recommendation: Update Public API sections in all domain modules to list all public functions.

2. Outdated Comments in MemberLive.Form

Problem: @moduledoc in lib/mv_web/live/member_live/form.ex still mentions "Payment Data: Mockup section (not editable)", but Membership Fees are now fully implemented.

Affected File:

  • lib/mv_web/live/member_live/form.ex (Line 16)

Priority: Low (Documentation, no functionality affected)

Recommendation: Update @moduledoc to reflect the current status.

3. Mv.Accounts Domain Public API Missing Completely

Problem: The @moduledoc in lib/accounts/accounts.ex does not mention any Public API functions, although several are defined.

Affected File:

  • lib/accounts/accounts.ex - Missing Public API documentation for:
    • create_user/1
    • list_users/0
    • update_user/2
    • destroy_user/1
    • create_register_with_rauthy/1
    • read_sign_in_with_rauthy/1

Priority: Low (Documentation, no functionality affected)

Recommendation: Add Public API section to @moduledoc, similar to other domain modules.

4. Mv.Authorization Domain Public API Missing get_role/1

Problem: The @moduledoc in lib/mv/authorization/authorization.ex does not list get_role/1 in the Public API, although it is defined.

Affected File:

  • lib/mv/authorization/authorization.ex - Missing function in Public API:
    • get_role/1 (is defined, but not mentioned in Public API)

Priority: Low (Documentation, no functionality affected)

Recommendation: Add get_role/1 to the Public API list.

5. Remove Deprecated Implementations

Problem: lib/mv_web/live/custom_field_value_live/show.ex MvWeb.ContributionTypeLive.Index and MvWeb.ContributionPeriodLive.Show are deprecated, they should be removed.

6. Missing Tests for Some LiveViews

Problem: Some LiveViews do not have corresponding test files.

Affected LiveViews:

  • MvWeb.UserLive.Show - No test present
  • MvWeb.RoleLive.Show - No test present

Priority: Medium (Test coverage could be improved)

Recommendation: Add tests for the three Show LiveViews to ensure complete test coverage.

7. Mv.Accounts.Token @moduledoc Too Short

Problem: The @moduledoc in lib/accounts/token.ex is very short and not informative.

Affected File:

  • lib/accounts/token.ex - Currently only: "AshAuthentication specific ressource"

Priority: Low (Documentation, no functionality affected)

Recommendation: Expand @moduledoc to explain that this is an AshAuthentication Token Resource and is used for session management.

8. PageController Missing @moduledoc

Problem: The @moduledoc in lib/mv_web/controllers/page_controller.ex is completely missing.

Affected File:

  • lib/mv_web/controllers/page_controller.ex - No @moduledoc present

Priority: Low (Documentation, no functionality affected)

Recommendation: Add @moduledoc to explain that this controller renders the homepage.

Note: Other controller modules (Router, Endpoint, Telemetry) also do not have @moduledoc, but this is common and acceptable for standard Phoenix modules.

Analysis Summary

Found Inconsistencies

1. Domain Public API Documentation Incomplete (see Code Adjustments #1)
2. Outdated Comments in MemberLive.Form (see Code Adjustments #2)
3. Mv.Accounts Domain Public API Missing Completely (see Code Adjustments #3)
4. Mv.Authorization Domain Public API Missing get_role/1 (see Code Adjustments #4)
5. CustomFieldValueLive.Show is Deprecated (see Code Adjustments #5)
6. Missing Tests for Some LiveViews (see Code Adjustments #6)
7. Mv.Accounts.Token @moduledoc Too Short (see Code Adjustments #7)
8. PageController Missing @moduledoc (see Code Adjustments #8)

### 1. Domain Public API Documentation Incomplete **Problem:** The `@moduledoc` in domain modules does not list all public functions. **Affected Files:** - `lib/membership/membership.ex` - Missing functions in Public API: - `list_required_custom_fields/0` - `update_member_field_visibility/2` - `update_single_member_field_visibility/3` - `lib/accounts/accounts.ex` - Very short Public API documentation, could be more detailed - `lib/membership_fees/membership_fees.ex` - Public API is complete, but could more clearly document that LiveViews use direct Ash calls **Priority:** Low (Documentation, no functionality affected) **Recommendation:** Update Public API sections in all domain modules to list all public functions. ### 2. Outdated Comments in MemberLive.Form **Problem:** `@moduledoc` in `lib/mv_web/live/member_live/form.ex` still mentions "Payment Data: Mockup section (not editable)", but Membership Fees are now fully implemented. **Affected File:** - `lib/mv_web/live/member_live/form.ex` (Line 16) **Priority:** Low (Documentation, no functionality affected) **Recommendation:** Update `@moduledoc` to reflect the current status. ### 3. Mv.Accounts Domain Public API Missing Completely **Problem:** The `@moduledoc` in `lib/accounts/accounts.ex` does not mention any Public API functions, although several are defined. **Affected File:** - `lib/accounts/accounts.ex` - Missing Public API documentation for: - `create_user/1` - `list_users/0` - `update_user/2` - `destroy_user/1` - `create_register_with_rauthy/1` - `read_sign_in_with_rauthy/1` **Priority:** Low (Documentation, no functionality affected) **Recommendation:** Add Public API section to `@moduledoc`, similar to other domain modules. ### 4. Mv.Authorization Domain Public API Missing get_role/1 **Problem:** The `@moduledoc` in `lib/mv/authorization/authorization.ex` does not list `get_role/1` in the Public API, although it is defined. **Affected File:** - `lib/mv/authorization/authorization.ex` - Missing function in Public API: - `get_role/1` (is defined, but not mentioned in Public API) **Priority:** Low (Documentation, no functionality affected) **Recommendation:** Add `get_role/1` to the Public API list. ### 5. Remove Deprecated Implementations **Problem:** `lib/mv_web/live/custom_field_value_live/show.ex` `MvWeb.ContributionTypeLive.Index` and `MvWeb.ContributionPeriodLive.Show` are deprecated, they should be removed. ### 6. Missing Tests for Some LiveViews **Problem:** Some LiveViews do not have corresponding test files. **Affected LiveViews:** - `MvWeb.UserLive.Show` - No test present - `MvWeb.RoleLive.Show` - No test present **Priority:** Medium (Test coverage could be improved) **Recommendation:** Add tests for the three Show LiveViews to ensure complete test coverage. ### 7. Mv.Accounts.Token @moduledoc Too Short **Problem:** The `@moduledoc` in `lib/accounts/token.ex` is very short and not informative. **Affected File:** - `lib/accounts/token.ex` - Currently only: "AshAuthentication specific ressource" **Priority:** Low (Documentation, no functionality affected) **Recommendation:** Expand @moduledoc to explain that this is an AshAuthentication Token Resource and is used for session management. ### 8. PageController Missing @moduledoc **Problem:** The `@moduledoc` in `lib/mv_web/controllers/page_controller.ex` is completely missing. **Affected File:** - `lib/mv_web/controllers/page_controller.ex` - No @moduledoc present **Priority:** Low (Documentation, no functionality affected) **Recommendation:** Add @moduledoc to explain that this controller renders the homepage. **Note:** Other controller modules (Router, Endpoint, Telemetry) also do not have @moduledoc, but this is common and acceptable for standard Phoenix modules. ## Analysis Summary ### Found Inconsistencies **1. Domain Public API Documentation Incomplete** (see Code Adjustments #1) **2. Outdated Comments in MemberLive.Form** (see Code Adjustments #2) **3. Mv.Accounts Domain Public API Missing Completely** (see Code Adjustments #3) **4. Mv.Authorization Domain Public API Missing get_role/1** (see Code Adjustments #4) **5. CustomFieldValueLive.Show is Deprecated** (see Code Adjustments #5) **6. Missing Tests for Some LiveViews** (see Code Adjustments #6) **7. Mv.Accounts.Token @moduledoc Too Short** (see Code Adjustments #7) **8. PageController Missing @moduledoc** (see Code Adjustments #8)
moritz self-assigned this 2026-01-20 17:03:28 +01:00
moritz added 8 commits 2026-01-20 17:03:29 +01:00
- Remove CustomFieldValueLive (Index, Form, Show)
- Remove ContributionTypeLive.Index
- Remove ContributionPeriodLive.Show
- Remove corresponding routes from router
- Remove references in CustomFieldValueLive.Index
- Add comprehensive tests for UserLive.Show
- Add comprehensive tests for RoleLive.Show
- Cover mount, display, navigation, and error handling
Replace expensive length/1 calls with direct list comparison
to fix Credo warnings about performance
- Extract helper functions from process_chunk to reduce nesting
- Extract format_error_message from extract_changeset_error
- Split extract_error_message into smaller functions to reduce complexity
- Fixes Credo refactoring opportunities
- Add translations for validation error messages
- Add translations for save failure messages
test: Remove outdated TODO for auto-assignment feature
Some checks reported errors
continuous-integration/drone/push Build was killed
235154a102
Auto-assignment of default membership fee type is already implemented
via SetDefaultMembershipFeeType change. Test assertion is now active.
moritz added this to the Sprint 11: 08.01-29.01 project 2026-01-20 17:03:31 +01:00
moritz added 1 commit 2026-01-20 17:04:49 +01:00
chore: rm todo list
All checks were successful
continuous-integration/drone/push Build is passing
2dc0bce8cb
moritz merged commit 264323504f into main 2026-01-20 17:59:24 +01:00
moritz deleted branch refactor 2026-01-20 17:59:25 +01:00
Sign in to join this conversation.
No description provided.