Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excluding Pods from SwiftLint configuration

I'm integrating SwiftLint, via Cocoapods, into an existing project.

My project directory is as such:

AppNameRepo
|-- AppName
|   |--.swiftlint.yml
|--AppName.xcworkspace
|--Pods

And my .swiftlint.yml, as I've tried to exclude pods:

included: # paths to include during linting. `--path` is ignored if present.
- Project
- ProjectTests
- ProjectUITests
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
- ../Pods
- ./Pods
- /Pods
- Project/R.generated.swift
- Project/Pods

I don't really understand what it's resolving the 'Project' tag to, so I'm grasping at straws here to get to exclude the Pod directory that's up a level from where the .swiftlint.yml file resides. I tried moving the .swiftlint.yml up a level, so it sat along side /AppName and /Pods, but then no matter what I changed on the included (which, I didn't think would need to be changed as I assumed it recursively worked in), swiftlint would claim there was no lintable files, so I'm at a loss for next steps.

like image 923
agreendev Avatar asked Jul 06 '18 14:07

agreendev


2 Answers

Since 0.43.0 versión, you need to specify a path relative to the current working directory, so you can use ${PWD}:

excluded:
  - ${PWD}/Pods
like image 58
pableiros Avatar answered Nov 03 '22 07:11

pableiros


Swiftlint is resolving paths relative to itself. Move the .swiftlint.yml file up a level. Project should be changed to reflect your AppName folder rather than the project name. Your swiftlint file will look like this:

included:
  - AppName

excluded:
  - Pods
like image 38
Sean Kladek Avatar answered Nov 03 '22 06:11

Sean Kladek