Search code examples
swiftlint

SwiftLint cannot exclude the nested files


I try to exclude all the unit test files. But it does not work. Does SwiftLint support nested exclude?

  - Pods
  - Carthage
  - ".*Tests.swift"
# Errors
force_try: warning #All errors occur in Nimble pod, this can be ignored
force_cast:
  severity: warning
  excluded:
    - "*Tests.swift"

Solution

  • You can include folder path in the excluded path section, For nested file workaround, try keeping it in a single folder to exclude the files or mention them in exclude file section.
    For Example

    excluded: # paths to ignore during linting. Takes precedence over `included`.
      - pH7-DriverTests
      - pH7-DriverUITests
      - Pods
    

    Example:- project's Test & UITest folder name is 'pH7-DriverTest' and 'pH7-DriverUITest' and it contains in source folder. Project file path