Warning
This repo is very early in its development, and currently only intended for experimental use.
This repo provides ways to skim the "surface" of the Lean process—linter executions and file endings—to capture and persist data which is usually ephemeral.
Specifically, we provide a hierarchy of features:
- Declarations tagged with
@[cleanup]are run at the end of every file. - A
LinterWithCleanupwaits for itself to finish running on all declarations, then runs acleanupat the end of each file. In this way, it has the potential to persist state into the environment by modifying refs. (These currently can only be run noninteractively.) PersistentLinters,AccumulativeLinters, andSimpleAccumulativeLinters provide convenient ways to construct aLinterWithCleanupwith an associatedIO.RefandPersistentEnvExtensionthrough and into which state can be persisted.- (In progress) We provide a
refactoraccumulative linter which can record edits from within linters, and awrite_editsexe which can write the recorded edits. - (TODO) We provide an extensible way to provide both syntax- and infotree-based refactoring rules to a
refactoringLinter : AccumulativeLinter.
@[cleanup]:
- Consider using a ref instead of an attribute
- Handle
erasedand scoping; use a more appropriate attribute implementation
AccumulativeLinter:
- Handle
#guard_msgs, which breaks range recording. How do we find the "full" range? - Explore handling interactive use
- Explore not recording ranges at all when interactive
- Explore writing to other files, not the (main) olean, to make executing the edits better. Reasonable when, as with
Edits, we do not rely on the environment etc. to (de)serialize.- Explore "fragmentary" module data/other "mostly" environment-independent means of (de)serializing Lean data (e.g. in a "constant" environment/no initializing)
- Explore using facets?
- Make setting up controlling options more convenient
- Explore ways for other linters to hook into framework, esp. tactic analysis framework
- Infrastructure
- Create utilities for more targeted actions (e.g. folders instead of library, only dependents of a single file, etc.)
- Documentation, documentation, documentation!
