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

Convert SwiftLint custom rules to AnyLint checks #14

Open
Jeehut opened this issue Apr 21, 2020 · 1 comment
Open

Convert SwiftLint custom rules to AnyLint checks #14

Jeehut opened this issue Apr 21, 2020 · 1 comment

Comments

@Jeehut
Copy link
Member

Jeehut commented Apr 21, 2020

Such a converter could transform this:

class_name_suffix_collection_view_controller:
    included: ".*\.swift"
    regex: 'class +\w+(?<!CollectionViewController) *(?:<[^>]+>)? *: +\w+CollectionViewController'
    name: "Class Name Suffix View Controller"
    message: "All `CollectionViewController` subclasses should end on `CollectionViewController`."
    severity: warning

to something like this:

// MARK: ClassNameSuffixCollectionViewController
    try Lint.checkFileContents(
        checkInfo: "ClassNameSuffixCollectionViewController: All `CollectionViewController` subclasses should end on `CollectionViewController`.",
        regex: #"class +\w+(?<!CollectionViewController) *(?:<[^>]+>)? *: +\w+CollectionViewController"#,
        matchingExamples: [], // TODO: [2020-04-21] not yet implemented
        nonMatchingExamples: [], // TODO: [2020-04-21] not yet implemented
        includeFilters: #".*\.swift"#
    )
@Jeehut
Copy link
Member Author

Jeehut commented Jul 2, 2021

Consider showing a warning before doing the conversion with a hint that all SwiftLint rules that only work on specific kinds of Swift structures (e.g. only methods) might not work as expected. Consider adding a warning comment in the converted AnyLint configuration file. Also warn the user to make sure they have committed their code before running the new configuration file.

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

No branches or pull requests

1 participant