Stacy Grey
Stacy Grey

Reputation: 93

How to uninstall swiftlint from xcode, or to turn its warnings off

Please help me to understand how to uninstal swiftlint, or how to switch it warnings off completely(because it starts to ignore all rules from time to time). I installed swiftilnt from pkg file, and now cannot find a way to remove it. "run from Makefile" solution does not help me, because i don't understand where it is, and how to run it. In Xcode preferences i also can't find a way to uninstall it. Also i search in finder for "swiftlint", and it cannot find it too.

Xcode 8.2.1

Upvotes: 9

Views: 12561

Answers (3)

AdPiscinam
AdPiscinam

Reputation: 170

Try this :

  1. Go to your Project in the Navigation area (left column, blue icon on the very top)

  2. Select your app target in the Targets line.

  3. Go "Build Phases" tab

  4. In Run Script, delete the command line under "Shell" text field that looks like this: (You can also just comment a line by adding # at the start of it, as mentioned below)

     if which swiftlint >/dev/null; then
     swiftlint
     else
     echo "warning: SwiftLint not installed, download from 
     https://github.com/realm/SwiftLint"
     fi
    
  5. Build Again to check !

This works for me and has the advantage to put it back later very easily. Hope it helps

Upvotes: 17

Let's_Create
Let's_Create

Reputation: 3613

There are two parts of the question:

  1. How to uninstall Swiftlint from Xcode?

    a. If you have installed SwiftLint from a package installer, then:

    rm -rf "/Library/Frameworks/SwiftLintFramework.framework"
    rm -f "/usr/local/bin/swiftlint"
    

    b. If you have installed through homebrew then:

    brew unlink swiftlint
    brew uninstall --force swiftlint
    
  2. Turn its warnings off,-

    a. If you want to turn off any specific warning/error please prefer the SwiftLint rule

    This is the nice document https://swifting.io/blog/2016/03/29/11-swiftlint/ suggested by @Andriy

    b. If you want to completely switch it off, remove this from the shell script:

    if which swiftlint >/dev/null; then
        swiftlint
    else
        echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
    fi
    

    Added it again whenever required.

Upvotes: 2

Andriy Savran
Andriy Savran

Reputation: 545

If you want to have a possibility to control which rule is disabled/enabled and to set thresholds for warnings and errors for a given rule, just create a .swiftlint.yml file in your project directory...

Take a look at this article:

https://swifting.io/blog/2016/03/29/11-swiftlint/

Upvotes: -3

Related Questions