refactor: adopt alias __MODULE__ for struct references#67
Merged
Conversation
00cd905 to
562dbda
Compare
Convert %__MODULE__{} builds, matches, updates, and @type t definitions
to the module's short name with alias __MODULE__ in scope, matching the
existing exemplar in memory/store/hybrid.ex. 37 files, ~253 refs.
Process-identity uses (GenServer.start_link(__MODULE__, ...), :ets,
@behaviour) are untouched, as are errors/base.ex and errors.ex (macro
hygiene / single-use noise) and four 1-ref files.
Multi-module files got one alias per struct module: eval/result.ex
(Result + SuiteResult) and eval/metrics.ex (Metrics + Metrics.Summary).
Zero behavior change: alias is compile-time. Full suite 1992 passed /
102 excluded (baseline match), credo --strict clean, docs warning-free.
562dbda to
66d0dfc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adopts the
alias __MODULE__idiom for struct references across the library:%__MODULE__{...}builds, pattern matches, update syntax, and@type tdefinitionsbecome the module's short name (
%Message{},%Context{}, …). 37 files, ~253 refs,matching the existing exemplar in
memory/store/hybrid.ex.Several moduledocs already wrote examples with the short name (
Registry.new(),Agent.new(...)) — the alias makes those docs literally accurate.Scope
GenServer.start_link(__MODULE__, ...),:ets.new(__MODULE__, ...),@behaviour, callback-module arguments)errors/base.ex(refs insidequote do— macro hygiene),errors.ex(9 submodules × 1 ref — alias noise), four 1-ref filesNotes for review
eval/result.ex(
Result+SuiteResult) andeval/metrics.ex(Metrics+Metrics.Summary)Registry,Agent,Node) were audited per file —no stdlib calls to those names exist in the converted files
skill.ex's two refs verified to sit outside its__using__quote blockVerification
Zero behavior change —
aliasis compile-time lexical.mix test: 1992 passed (7 doctests), 102 excluded — exact baseline matchmix compile --warnings-as-errors,mix format --check-formatted,mix credo --strict(0 issues),mix docswarning-freegrep -rn "%__MODULE__{" libshows only the 15 documented exclusion refs