Gate function size, module coupling and duplication with a Credo ratchet closes #541 #677

Merged
simon merged 9 commits from issue/mitgliederverwaltung-541 into main 2026-11-13 15:08:37 +01:00
Owner

closes #541

Description of the implemented changes

The changes were:

  • Bugfixing
  • New Feature
  • Breaking Change
  • Refactoring

Code quality: CI now fails when a function grows too complex, a module depends on too many others or code is duplicated, with limits that only move down.

What has been changed?

  • Accumulate chunk results in a map instead of a seven-element tuple
  • Load the edited role in one helper instead of repeating the error handling in mount
  • Cover an invalid amount in the create cycle dialog
  • Split creating a fee cycle into parsing, creating and error mapping
  • Gate function size, module coupling and duplication as a ratchet
  • Explain what to do when the structural Credo ratchet fails
  • Keep the typed amount when the date changes in the create cycle dialog
  • Note that a new fee cycle keeps the typed amount after a date change

Definition of Done

Code Quality

  • No new technical depths
  • Linting passed
  • Documentation is added were needed

Accessibility

  • New elements are properly defined with html-tags
  • Colour contrast follows WCAG criteria
  • Aria labels are added when needed
  • Everything is accessible by keyboard
  • Tab-Order is comprehensible
  • All interactive elements have a visible focus

Testing

  • Tests for new code are written
  • All tests pass
  • axe-core dev tools show no critical or major issues

Additional Notes

  • Limits: ABCSize 40, ModuleDependencies 25 (router excluded), DuplicatedCode mass 40, for lib/ and dev/ only. The issue suggested today's maximum or about 20 dependencies; measured on main, today's maximum is 75/55 and 20 would flag most Ash resources, so the first step is 40/25 with the remaining excess marked. Later steps (ABC 35 → 30, dependencies 20 → 15, mass 35) are in the comment block in .credo.exs.
  • Code still above a limit carries # Ratchet (debt|flat|hub): <reason> and # credo:disable-for-next-line <check> directly above its def or defmodule (12 functions, 6 modules). test/mv/architecture/credo_ratchet_test.exs pins the limits and the exact marker list, so a raised limit, a new marker or a file-wide disable fails CI.
  • Larger commit: "Gate function size, module coupling and duplication as a ratchet" (17 files, mostly the two-line markers).
  • Behavior change a reviewer might not expect: the create cycle dialog now sends a change event for the whole form instead of the date input only, so a typed amount survives a date change. The bug also exists on main.
  • Specs and VariableRebinding stay disabled, now with a reason in .credo.exs.
closes #541 ## Description of the implemented changes The changes were: - [x] Bugfixing - [ ] New Feature - [ ] Breaking Change - [x] Refactoring Code quality: CI now fails when a function grows too complex, a module depends on too many others or code is duplicated, with limits that only move down. ## What has been changed? - Accumulate chunk results in a map instead of a seven-element tuple - Load the edited role in one helper instead of repeating the error handling in mount - Cover an invalid amount in the create cycle dialog - Split creating a fee cycle into parsing, creating and error mapping - Gate function size, module coupling and duplication as a ratchet - Explain what to do when the structural Credo ratchet fails - Keep the typed amount when the date changes in the create cycle dialog - Note that a new fee cycle keeps the typed amount after a date change ## Definition of Done ### Code Quality - [ ] No new technical depths - [x] Linting passed - [x] Documentation is added were needed ### Accessibility - [ ] New elements are properly defined with html-tags - [ ] Colour contrast follows WCAG criteria - [ ] Aria labels are added when needed - [ ] Everything is accessible by keyboard - [ ] Tab-Order is comprehensible - [ ] All interactive elements have a visible focus ### Testing - [x] Tests for new code are written - [x] All tests pass - [ ] axe-core dev tools show no critical or major issues ## Additional Notes - Limits: ABCSize 40, ModuleDependencies 25 (router excluded), DuplicatedCode mass 40, for `lib/` and `dev/` only. The issue suggested today's maximum or about 20 dependencies; measured on `main`, today's maximum is 75/55 and 20 would flag most Ash resources, so the first step is 40/25 with the remaining excess marked. Later steps (ABC 35 → 30, dependencies 20 → 15, mass 35) are in the comment block in `.credo.exs`. - Code still above a limit carries `# Ratchet (debt|flat|hub): <reason>` and `# credo:disable-for-next-line <check>` directly above its `def` or `defmodule` (12 functions, 6 modules). `test/mv/architecture/credo_ratchet_test.exs` pins the limits and the exact marker list, so a raised limit, a new marker or a file-wide disable fails CI. - Larger commit: "Gate function size, module coupling and duplication as a ratchet" (17 files, mostly the two-line markers). - Behavior change a reviewer might not expect: the create cycle dialog now sends a change event for the whole form instead of the date input only, so a typed amount survives a date change. The bug also exists on `main`. - `Specs` and `VariableRebinding` stay disabled, now with a reason in `.credo.exs`.
simon merged commit f0b7d4c847 into main 2026-11-13 15:08:37 +01:00
simon deleted branch issue/mitgliederverwaltung-541 2026-11-13 15:08:37 +01:00
Sign in to join this conversation.
No description provided.