https://github.com/terror/flint
Write custom, lightweight static checkers using the tree-sitter query language
https://github.com/terror/flint
Last synced: 10 months ago
JSON representation
Write custom, lightweight static checkers using the tree-sitter query language
- Host: GitHub
- URL: https://github.com/terror/flint
- Owner: terror
- License: cc0-1.0
- Created: 2022-06-19T20:18:50.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-24T15:29:13.000Z (over 1 year ago)
- Last Synced: 2025-03-14T22:03:19.309Z (10 months ago)
- Language: Rust
- Homepage:
- Size: 33.2 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- License: LICENSE
Awesome Lists containing this project
README
**flint** is a tool that lets you write custom, lightweight static checkers
using the tree-sitter query language.
Checkers are specified in [YAML](https://en.wikipedia.org/wiki/YAML) files that
follow a certain structure, for instance:
```yaml
name: Rust
language: rust
rules:
env_string_literals:
severity: warn
category: style
message: Calls to (std::|)env::(var|remove_var) should not use string literals
query: |
((call_expression
function: (_) @function
arguments: (arguments (string_literal))) @raise
(#match? @function "(std::|)env::(var|remove_var)"))
captures:
- raise
```
See [examples/rust.yaml](https://github.com/terror/flint/blob/master/examples/rust.yaml)
for a more fully expanded example.
### Installation
```
git clone https://github.com/terror/flint.git
cd flint
cargo install --path .
```
### Prior Art
This tool wouldn't have been possible without [tree-sitter](https://tree-sitter.github.io/tree-sitter/), relying
on heavy use of the [rust bindings](https://docs.rs/tree-sitter/latest/tree_sitter/) as well.