Chasten Your Python Program: Configurable Program Analysis and Linting with XPath
summary
Chasten is an open source Python tool that runs XPath queries over the Python AST (via pistgrep) to implement YAML-configured checks, emit results to JSON/CSV/SQLite and serve interactive views with Datasette. Example run finds seven nested-loop matches in a small codebase; rules live in a YAML database and gates can fail CI builds. It trades type inference and Rust-level speed for ease of ad hoc pattern writing and project-specific linting.
AI-written summary · about
chapters (9)
- 0:00Chasten introduction
- 3:58Who benefits from Chasten
- 8:55Avoid reinventing analysis
- 12:29Alternatives to regular expressions for code analysis
- 16:21Understanding abstract syntax trees in Python
- 20:15Chasten and PIST grep
- 23:26Detecting nested loops
- 26:15Chasten limitations
- 28:21Conclusion
related talks
28mPreventing headaches with linters and automated checks
45mTest-Driven Development of a Static Code Analyzer in Python
27mPyre, Lints, Codemods, Code Quality, and You
20mHidden Hacks in Linters for Better & More Secure Code
27mPython Linters at Scale
30mAutomating Code Quality
27mAn Overview of the Python Code Tool Landscape 2023
22mEasier Lint Authoring with Semantic Search and (...)
