SwiftLint/Source/swiftlint/Commands
Elliott Williams ba8bfcae22
Add RuleStorage and a pre-linting stage to run collection
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
2019-07-13 10:32:12 -07:00
..
AnalyzeCommand.swift Add RuleStorage and a pre-linting stage to run collection 2019-07-13 10:32:12 -07:00
AutoCorrectCommand.swift Add RuleStorage and a pre-linting stage to run collection 2019-07-13 10:32:12 -07:00
GenerateDocsCommand.swift Remove all file headers 2018-05-04 13:42:02 -07:00
LintCommand.swift Add ability for SwiftLint to lint files with full type-checked AST awareness (#2379) 2018-09-02 00:13:27 -07:00
RulesCommand.swift Only mark custom rules as enabled in your config when custom rules are configured. 2018-11-28 13:42:11 -08:00
VersionCommand.swift Remove all file headers 2018-05-04 13:42:02 -07:00