feat(lint): dogfood ast-grep rules#243
Merged
Merged
Conversation
### Summary Adopt the ast-grep project layout in Flakebox itself with six conservative Rust rules. Keep rules and tests under `.config/ast-grep/`, retain root project discovery through `sgconfig.yml`, and add a flake check that scans the source and runs the rule test suite. ### Details The rules discourage production `unwrap`, check-then-unwrap control flow for Option and Result, eager default construction, and greater-than comparison orientation for simple side-effect-free operands. CI promotes the five behavioral rules to errors while leaving comparison orientation as an interactive hint. Production unwrap permits explicit `expect`, ignores conventional test/example paths, and structurally excludes inline test functions, modules, and impl blocks across contiguous attributes. Each rule has valid/invalid cases and committed diagnostic snapshots; path scan fixtures verify every ignore and prove production violations fail CI. Existing findings were resolved by documenting the OpenSSL fixture invariant with `expect` and reversing one side-effect-free signal-state comparison. ### Reviews The reviewer first found that warning-level scans could not fail CI, file ignores lacked behavioral coverage, test-code exemptions were incomplete, and unrestricted comparison orientation could pressure unsafe operand reordering. I promoted behavioral rules only, added positive and negative path fixtures, expanded structural test exemptions, and limited comparisons to identifiers and integer literals. Re-review then found multi-attribute and cfg(test) impl gaps; the final rule traverses only contiguous attributes and covers functions, modules, and impls. Final re-review passed with no issues. ### Verification `selfci check --candidate lxuqqqqz` passed after all reviewed fixes.
dpc
marked this pull request as ready for review
July 24, 2026 18:04
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.
Posted by Tau
Summary
Adopt the newly integrated ast-grep workflow in Flakebox itself with six conservative Rust rules, focused rule tests, and CI enforcement. Keep the rule implementation under
.config/ast-grep/while preserving standard root project discovery throughsgconfig.yml.Details
unwrap()while exempting conventional and structurally annotated test codeis_some/is_ok/is_errchecks followed by corresponding unwrap callsunwrap_orTesting
Run
selfci check. For focused iteration, runast-grep testandast-grep scan.