Skip to content

feat(lint): add ast-grep project integration#241

Merged
dpc merged 3 commits into
rustshop:masterfrom
dpc:dpc/jj-vqvoslkxqoxp
Jul 24, 2026
Merged

feat(lint): add ast-grep project integration#241
dpc merged 3 commits into
rustshop:masterfrom
dpc:dpc/jj-vqvoslkxqoxp

Conversation

@dpc

@dpc dpc commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Posted by Tau

Summary

Add native ast-grep integration to Flakebox so projects can run structural YAML rules through the same development-shell, just, and pre-commit workflows as existing linters.

Details

  • install a configurable ast-grep package by default
  • add just ast-grep
  • run ast-grep scan in pre-commit when a non-empty config exists
  • expose independent package, config path, recipe, hook, and hook-argument options
  • document a root sgconfig.yml with discrete .config/ast-grep/{rules,rule-tests} directories
  • cover module evaluation and generated-hook behavior

Testing

Run selfci check.

dpc added 2 commits July 24, 2026 10:13
### Summary

Add ast-grep as a default flakebox development tool and wire standard sgconfig.yml projects into just and pre-commit workflows. Repositories without a configuration remain unaffected because the hook exits quietly when its configured file is absent or empty.

### Details

The new module exposes package, configFile, just.enable, pre-commit.enable, and pre-commit.args options. The default just recipe runs `ast-grep scan`, while the generated hook honors native rule severities and supports CLI severity overrides. Evaluation tests cover defaults, independent disabling, custom packages and paths, and shell-escaped arguments. A generated-hook fixture verifies missing and empty configs skip the tool and a non-empty config passes the exact configured path and arguments. User documentation shows ast-grep's standard rules and rule-tests directory layout, and generated flakebox files were refreshed.

### Reviews

A reviewer found three documentation and coverage gaps: the moved-config example did not adjust paths or the test command; generated-hook skip and invocation behavior lacked behavioral coverage; and option isolation/custom package selection lacked complete evaluation coverage. I removed the inconsistent example and added the requested behavioral and evaluation tests. Re-review passed with only optional test-strengthening nits.

### Verification

`selfci check --candidate otzsxlon` passed after the reviewed fixups.
### Summary

Keep ast-grep's discoverable `sgconfig.yml` at the repository root while documenting rules and tests under `.config/ast-grep/`. This avoids invasive top-level tool directories without losing bare `ast-grep scan` and `ast-grep test` commands.

### Details

Update the recommended `ruleDirs` and `testConfigs` paths and explain why the split layout is preferable.

### Reviews

Not required for this small documentation-only change.

### Verification

`selfci check --candidate vqvoslkx` passed.
@dpc
dpc force-pushed the dpc/jj-vqvoslkxqoxp branch from 8002232 to 8fda0ad Compare July 24, 2026 17:13
@dpc
dpc marked this pull request as ready for review July 24, 2026 17:33
@dpc
dpc merged commit 7a776a5 into rustshop:master Jul 24, 2026
4 checks passed
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.

1 participant