mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
b1ca533649
In order for rules to collect arbitrary information about all files being linted, a shared RuleStorage instance is defined in each command and passed into the linter. Linting now requires two "passes": once to call collect and populate the storage (rules that are non-collecting do nothing here), and again to call validate. The old Linter factory now creates a Prelinter, which can collect for a file and produce a Linter that orchestrates all the traditional validation/collection logic. This design enforces that a file is only validated once it has been collected; in turn, the file-visiting loop ensures that all files are collected before the first is validated, so that the storage is fully populated. Use storage-backed correct method Crash if storage for a rule is accessed prematurely Key FileInfo by File Rename Prelinter to Linter and Linter to CollectedLinter Clean up rule protocols such that rule-facing storage methods are actually called Make RuleStorage a reference type to solve mutating data races