I want to ignore some files that start with _(because I'm using mogenerator). But it seems that it does nor work:
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- oTMS_Mobile/Model/CoreDataModel/_*.swift
Is this an unsupported feature or something wrong I write above?
Is this a duplicate of #560 Exclude files using regular expression.?
I don't think this is exactly a duplicate because this seems to use glob patterns and not regular expressions.
I don't think this is exactly a duplicate because this seems to use glob patterns and not regular expressions.
Although I think we'd probably just want to stick with one and not the other. Generally the approach is to use globbing syntax when it comes to specifying files, as far as I know.
+1 for globbing and just one of them
+1 I'd love to have a way to exclude all generated files, we put them under Generated folders. Something like this:
excluded:
- **/Generated
Excludes files in any folder called Generated.
I'm all for this. Anyone know of any good file globbing libraries written in Swift that are compatible with CocoaPods, Swift Package Manager and Carthage?
Is there any progress on #1712 or this issue?
We also have the case that we want to exclude files which are located in special folders or contain a certain string. Some of our projects are forced to use a unclean folder setup as we can't configure SwiftLint to ignore the files we need to.
Generated/Root
/App
/Generated
/Extensions
/Watch
/Generated
/Share
/Generated
/Root
/App
/Extensions
/Generated
/App
/Watch
/Share
Based on the README it's possible to use Regex for included and excluded in custom rules:
custom_rules:
pirates_beat_ninjas: # rule identifier
included: ".*\\.swift" # regex that defines paths to include during linting. optional.
...
@marcelofabri If Regex seems to be the way to go there, why not add it to exclude and include everythere?
If there doesn't seem to be a widely used file globbing library in Swift yet, Regex might be the way to for now.
I've implemented a possible solution for this here: https://github.com/realm/SwiftLint/pull/2316
This has been merged in https://github.com/realm/SwiftLint/pull/2316 and is part of 0.27.0. I think we can close this issue
Most helpful comment
+1 I'd love to have a way to exclude all generated files, we put them under Generated folders. Something like this:
Excludes files in any folder called Generated.