Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No lintable files found at paths SwiftLint

I tried to install SwiftLint using CocoaPods and I add in Build phases the following script :

"${PODS_ROOT}/SwiftLint/swiftlint" 

SwiftLint is installed correctly and I get many errors and warnings in the project.

Then, I create the swiftLint.yml file in which I modify some rules but they are not token into consideration and the same number of errors and warnings persist in Xcode project.

When I run this command to confirm the application of the rules :

    ./swiftlint lint --config .swiftlint.yml       

I get the error :

 No lintable files found at paths : ''

How can I solve this issue please?

like image 970
Rwaydha Avatar asked Apr 17 '19 16:04

Rwaydha


4 Answers

For those of you who used 0.42.0 before and updated to 0.43.0 (or higher?). They made a change and now interpret included and excluded as relative paths.

Configuration files now consistently have their included/excluded relative file paths applied relative to their location in the file system. Previously the root configuration file applied these relative to the current working directory, but nested configurations applied these to their location in the file system.

From the release notes of 0.43.0: Clothes Line Interface.

like image 159
Aaron Avatar answered Sep 22 '22 22:09

Aaron


It happens also if you rename the directory of your app, make sure you report the change in the .swiftlint.yml too at first lines :

 included: # paths to include during linting
    - My_App_Directory
like image 23
Medhi Avatar answered Oct 21 '22 02:10

Medhi


  • if you are using swiftLint with CocoaPods : try "${PODS_ROOT}/SwiftLint/swiftlint" --config .swiflint.yml in your SwiftLint Run Script in your project build phases.

  • make sure your .swiflint.yml config file is in the root of your project directory ( beside .xcodeproj file ).

  • make sure the paths included on your .swiflint.yml (in included: and excluded: sections ) is valid paths

  • make sure your .swiflint.yml file is valid yaml

  • don't escape the directory paths in your config file dont do : - some\ Directorybut do - some Directory without escape character.

like image 2
Ahmed Komsan Avatar answered Oct 21 '22 02:10

Ahmed Komsan


If you installed it using Cocoapods this can help you. I will just merely improve the above answers, to put clarity on how to resolve the issue of SwiftLint not finding the path.

Things to lookout for.

  • Make sure your swiftlint.yml file is valid.
  • Make sure the swiftlint.yml is in the same level as your .xcodeproj
  • Don't specify --path and also add an entry under included: inside your yml file, choose one, either specify the --path or add an entry don't use both otherwise SwiftLint will ignore the --path param, and if the entry specified inside included: is wrong you will get the "no lintable file found" error

In your script.

  • The gihub page of SwiftLint recommends just using "${PODS_ROOT}/SwiftLint/swiftlint" but that didn't work for me, I had to specify the --path see below for the full script.

"${PODS_ROOT}/SwiftLint/swiftlint" --path "${SRCROOT}/Classes" --config "directory-of-your-config"

The --path param should be your own --path "${SRCROOT}/Classes"

enter image description here

Finally inside the yml file.

Make sure your included and excluded file specification is correct, see how I did mine below.

included:
  - Your-Project-Name
  
excluded:
  - Pods

One Important thing to note is if you add directories under included: the --path param will be ignored, and you might possibly get the "no lintable files found" error if the directory is wrong.

like image 2
GyroCocoa Avatar answered Oct 21 '22 00:10

GyroCocoa