Skip to content

refactor: move rule modules into src/rules/<group>/ - #56

Open
mgiovani wants to merge 1 commit into
mainfrom
refactor/issue-7-rule-groups
Open

refactor: move rule modules into src/rules/<group>/#56
mgiovani wants to merge 1 commit into
mainfrom
refactor/issue-7-rule-groups

Conversation

@mgiovani

@mgiovani mgiovani commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Pure mechanical refactor for #7: the 44 flat rule files move from src/rules/<tell>.rs into src/rules/<group>/<tell>.rs, one subdirectory per groups.rs entry (artifact/, structure/, stdlib/, rhetoric/, verbosity/, sourcing/, format/). imports_data.rs stays at the top level because it is a shared table, not a rule.

Closes #7

Changes

  • 44 files moved with git mv, so the diff shows renames. Each group gets a mod.rs holding only alphabetical pub mod lines, and src/rules/mod.rs shrinks to the 7 group modules plus imports_data.
  • Only fully-qualified paths change: every registry::RULES entry and every cross-rule import gains a <group> segment. synonym_rotation's two super::fragmentation paths become crate::rules::rhetoric::fragmentation, because super:: now names verbosity.
  • RULES order, rule codes, messages, and group names are untouched.
  • AGENTS.md: "Adding a rule" steps 1 and 2 point at src/rules/<group>/, and the branch-prefix list gains refactor/, pairing with the refactor: commit type it already allowed.
  • CHANGELOG.md: ### Changed entry under Unreleased.

Library path note

lib.rs declares pub mod rules, so stopslop::rules::<module> is now stopslop::rules::<group>::<module>. Nothing in tests/, bench/, or the docs used the old paths, and the stopslop::imports_data re-export is unchanged. The changelog records it; the next release should be 0.6.0.

Verification

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test: all green (896 unit tests, fixture and witness suites pass).
  • groups_partition_every_rule runs unchanged.
  • stopslop . --list-rules and the dogfood run stopslop . (stdout and exit code) captured on main and on this branch: byte-identical.
  • Grep for any remaining crate::rules::<module> without a group segment or super::fragmentation: no hits.

Each of the 44 rule files moves into the subdirectory named after its
groups.rs entry; imports_data.rs stays at the top level because it is a
shared table, not a rule. Only fully-qualified paths change: every
registry::RULES entry and every cross-rule import gains a <group>
segment, and synonym_rotation's two super::fragmentation paths become
crate::rules::rhetoric::fragmentation since super:: now names verbosity.

RULES order, codes, messages, and group names are untouched;
--list-rules and the dogfood run are byte-identical before and after.
AGENTS.md gains the refactor/ branch prefix that pairs with the
refactor: commit type it already lists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: group rule modules into src/rules/<group>/ subdirectories

1 participant