Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template system #2

Open
Jeehut opened this issue Mar 18, 2020 · 1 comment · May be fixed by #37
Open

Add template system #2

Jeehut opened this issue Mar 18, 2020 · 1 comment · May be fixed by #37
Milestone

Comments

@Jeehut
Copy link
Member

Jeehut commented Mar 18, 2020

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.

@Jeehut
Copy link
Member Author

Jeehut commented Apr 11, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant