AnyLint
AnyLint copied to clipboard
Add template system
At the moment, we have 1 static template within the project, but instead we could build a template loading system, where different template portions could be combined to build a good starting template with a single command.
Also, a centralized separate repo might make sense to collect those templates. Similar to "rules" in other linters, but not included into AnyLint, instead loadable from anywhere with special treatment for the official community repo.
Here's a possible design of how the template system might work:
try Lint.runChecks(
source: .remote("https://raw.githubusercontent.com/Flinesoft/AnyLint/main/Templates/Swift/default.swift"),
atPath: "Tests",
runOnly: ["RequireReadme", "LineLength"],
exclude: ["RequireLicense"],
options: ["LineLength": 160]
)
The above example doesn't make sense as is (runOnly
& exclude
together are redundant), here's a more realistic and common option:
try Lint.runChecks(source: .community("Swift", variant: "default"))
Note that any template should stop with reportSummary()
which outputs a JSON formatted string and runChecks
should read that JSON and forward the violations to the Statistics
object.