ashfurrow / danger-ruby-swiftlint

A Danger plugin for SwiftLint.
https://rubygems.org/gems/danger-swiftlint
MIT License
203 stars 80 forks source link

Question: How do I make it use the globally installed swiftlint ? #189

Closed hlung closed 1 year ago

hlung commented 1 year ago

I know there is swiftlint.binary_path = '/path/to/swiftlint', but is there a way to do this without having to specify the path? Reason being we may need to change how we install swiftlint in future, and its binary path may change. This way we don't need to keep updating this path.

ashfurrow commented 1 year ago

You could run which swiftlint to get the path and set binary_path that way.

hlung commented 1 year ago

@ashfurrow oh can I use swiftlint.binary_path = which swiftlint ?

As I said, I don't want to manually put in path string, regardless of I can use which swiftlint to get that string.

hlung commented 1 year ago

Found it.

swiftlint.binary_path = `which swiftlint`.strip

Need strip because the output of which has \n at the end, which will fail danger with weird errors about Dangerfile being invalid.