fix: resolve minor best-practice items (#334)#344
Merged
Conversation
Closes the remaining minor items tracked under #334 so the issue can be fully resolved. Each fix is small and targeted. - #87 is_test_file: path-segment awareness so `latest`, `aspect`, `attestation`, `protest` are not mistaken for test files. - #66 glob_matches: directory excludes (`src/`) match only at segment boundaries (`mysrc/`, `docs/src-guide/` no longer caught). - #68 estimate_tokens: non-empty content returns at least 1 token (was 0 under integer division). - #72 RE_JAVA_IMPORT: allow wildcard capture (`import com.example.*` keeps the `*`), plus `import static`. - #73 RE_RUST_MOD: extract `mod foo;` declarations as dependency symbols, matching the documented behavior. - #23 index_stats: query `PRAGMA page_size` instead of assuming 4096 bytes. - #48 ReviewIssue.issue_type: serialize as `issue_type` (consistent with the field name); keep `type` as a deserialize alias. - #10 Severity::from_str_lossy: use `eq_ignore_ascii_case` (no allocation). Already-resolved items verified (no change needed): - #88 max_findings cutoff already sorts severity-descending before truncate. - #30 debt snapshot save already emits a warn! on write failure. 8 new tests. All 652 tests pass; clippy + fmt + audit clean. Closes #334
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.
Summary
Resolves the remaining minor best-practice items tracked under #334 so the issue can be fully closed. The P3-core items (#94, #81, #57, #58, #80) were already done in PR #342; this PR cleans up the 12 minor nits (8 implemented, 2 verified already-done, 2 noted).
Implemented fixes
security_scanner.rsis_test_fileuses path-segment awareness —latest,aspect,attestation,protestno longer mistaken for test filesrules/matching.rssrc/) match only at segment boundaries (mysrc/,docs/src-guide/no longer caught)context/types.rsestimate_tokensreturns ≥1 for non-empty content (was 0 under integer division)context/extraction.rsimport com.example.*) + supportsimport staticcontext/extraction.rsmod foo;extracted as a dependency symbol (matches documented behavior)index/mod.rsindex_statsqueriesPRAGMA page_sizeinstead of assuming 4096 bytesengine/types.rsissue_typeserializes asissue_type(consistent);typekept as deserialize aliasengine/types.rsSeverity::from_str_lossyuseseq_ignore_ascii_case(no allocation)Verified already-resolved (no change)
max_findingscutoff already sorts severity-descending (severity_rank) before truncating, so the worst findings are kept.save_snapshotalready emits awarn!-level log on write failure.Notes
issue_typeinstead oftype. Deserialization accepts bothissue_typeandtype(alias), so back-compat for LLM responses is preserved.Testing
cargo auditclean.Closes #334