---
title: "Test an AST review rule against a pinned commit | Proofline Help"
description: "Create a structural rule under Settings → Review policy → Review rules. Test the pattern against files at an exact commit before saving it for organization or repository reviews."
url: https://proofline.sh/help/test-ast-review-rule/
---

[Help center](/help/)

# Test an AST review rule against a pinned commit

Create a structural rule under Settings → Review policy → Review rules. Test the pattern against files at an exact commit before saving it for organization or repository reviews.

## Write and test an AST rule

An AST (abstract syntax tree) rule matches a structural code pattern with ast-grep. **AST rule** appears for new organization or repository rules only when the deployment supports reporting its findings. Team and environment rules use text guidance.

1.  Choose **AST rule** under **Rule type**.
2.  In **AST rule**, enter one ast-grep rule as YAML without an `id`. Include `language`, `severity`, `message`, and `rule`. Use optional `files` to restrict paths.
3.  Open **Test rule**.
4.  For an organization rule, select a **Repository**. A repository rule uses its own repository.
5.  Enter the full 40-character **Commit SHA** and repository-relative **File paths**, one file per line.
6.  Select **Run test**.
7.  Inspect the matches or the incomplete cause. Correct any field errors or unread paths and run the test again.
8.  Select **Save rule** to save the rule separately.

Before testing, confirm that analyzers are available and static analysis is enabled for the organization. The test runs the draft YAML against the named files at the selected commit without saving the rule.

Check whether the test completed before interpreting its matches. An incomplete test may show only partial results; it does not establish that no files match.

## Related guides

-   [Manage review rules](/help/review-rules/)
