4 ms·
I've not looked at the implementation details of Ruff, but I am of the opinion that lint tools should be based on an architecture like GitHub's stack graphs[1].
by wmanley 4y ago
I've not looked at the implementation details of Ruff, but I am of the opinion that lint tools should be based on an architecture like GitHub's stack graphs[1]. This is the technology that powers GitHub's code navigation.
Specifically: analysis is broken up into two phases:
1. one that only depends on the content of a file, and
2. a second one which deals with inter-file dependencies.
The advantage is that you can very effectively cache the results of (1). This makes that phase of the analysis not performance critical. Phase 2 has to be fast, but you can push as much expense into phase 1 as possible.
This provides scalability - both at the level of GitHub where people may view code from many different commits, but also for the live editing case where you may be editing a small number of files in a much larger project. The effects of your small changes may affect many of your dependencies and you want to know the lint errors immediately.
[1]: https://github.blog/2021-12-09-introducing-stack-graphs/ https://github.blog/2021-12-09-introducing-stack-graphs/
- PoignardAzur 4y agoInteresting. I've been thinking about an architecture like this for a while, in the context for the Salsa crate (a query engine for compilers). I wonder if the Salsa maintainers have considered this.