feat(cli): load rules database from file - #78
Conversation
|
@alexsmolya Welcome, and thanks for the contribution! Nice to have you here. 🙌 I went through the implementation, the tests, the contributing guide and the docs. The change is nicely scoped: it stays at the CLI boundary, fails before the scan starts if the file is bad, and keeps stdout clean in JSON mode. Test coverage for embedded / valid / missing / malformed is good to see. Left a few comments inline. Only the docs one really blocks, the rest we can talk through. Once that's sorted I'm happy to approve and merge. |
|
On the docs point, this is the table I meant: diskern/crates/diskern-cli/README.md Lines 51 to 55 in 60d5f1b A row right under | |
|
@alexsmolya Great turnaround, thanks for picking these up so quickly! 🙌 Both fixes landed in Two small leftovers, neither blocking:
Push those when you get a chance and I'll take it from there. And welcome to Coding Moves, really glad to have you here. 🚀 |
|
@alexsmolya Quick follow-up so you don't spend time on this: I picked up the two leftovers myself rather than hold the PR for another round trip, so there's nothing left for you to push. They're in #97 — the This is merged, and it closes #68. Thanks again — turning the protected-rule case into a regression test is the part that'll keep paying off long after the flag itself is old news. Looking forward to the next one. |
|
@alexsmolya Your change went out in v0.2.0 today, and you're in the release notes 🎉 Thanks again for turning the review around so fast. Honestly the best bit was the test you added for the protected rule case, not the fix itself. I've left comments on #94 as well, that one's a big piece of work. When you're through it, #69 is a If you like the project, a ⭐ helps people find it. See you on the next one 🚀 |
What & why
Fixes #68
diskern scancan now accept an optional external rules database:Without
--rules, the CLI continues to use the embedded rules database. A supplied file is deserialized through the existingRulesDbmodel, with explicit errors for unreadable files and malformed JSON. Human-readable output identifies the external rules source, while JSON output remains valid on stdout. The change stays at the CLI boundary and does not move classification logic out ofdiskern-core.The user-visible feature is documented in
CHANGELOG.md.Validation
cargo fmt --allcargo +1.96.0 clippy -p diskern-core -p diskern-cli --all-targets -- -D warningscargo +1.96.0 test -p diskern-core -p diskern-cligit diff --checkAll passed. The focused suite includes regression coverage for embedded rules, valid external rules, missing files, and malformed JSON.
Checklist
cargo fmt --alland the required core/CLI clippy validation are clean