Class: Swiftlint
- Inherits:
-
Object
- Object
- Swiftlint
- Defined in:
- ext/swiftlint/swiftlint.rb
Instance Method Summary collapse
-
#initialize(swiftlint_path = nil) ⇒ Swiftlint
constructor
A new instance of Swiftlint.
-
#is_installed? ⇒ Boolean
Return true if swiftlint is installed or false otherwise.
-
#lint(options, additional_swiftlint_args) ⇒ Object
Shortcut for running the lint command.
-
#run(cmd = 'lint', additional_swiftlint_args = '', options = {}) ⇒ Object
Runs swiftlint.
-
#swiftlint_path ⇒ Object
Return swiftlint execution path.
Constructor Details
#initialize(swiftlint_path = nil) ⇒ Swiftlint
Returns a new instance of Swiftlint.
3 4 5 |
# File 'ext/swiftlint/swiftlint.rb', line 3 def initialize(swiftlint_path=nil) @swiftlint_path = swiftlint_path end |
Instance Method Details
#is_installed? ⇒ Boolean
Return true if swiftlint is installed or false otherwise
24 25 26 |
# File 'ext/swiftlint/swiftlint.rb', line 24 def is_installed? File.exist?(swiftlint_path) end |
#lint(options, additional_swiftlint_args) ⇒ Object
Shortcut for running the lint command
19 20 21 |
# File 'ext/swiftlint/swiftlint.rb', line 19 def lint(, additional_swiftlint_args) run('lint', additional_swiftlint_args, ) end |
#run(cmd = 'lint', additional_swiftlint_args = '', options = {}) ⇒ Object
Runs swiftlint
8 9 10 11 12 13 14 15 16 |
# File 'ext/swiftlint/swiftlint.rb', line 8 def run(cmd='lint', additional_swiftlint_args='', ={}) # change pwd before run swiftlint if .has_key? :pwd Dir.chdir .delete(:pwd) end # run swiftlint with provided options `#{swiftlint_path} #{cmd} #{swiftlint_arguments(, additional_swiftlint_args)}` end |
#swiftlint_path ⇒ Object
Return swiftlint execution path
29 30 31 |
# File 'ext/swiftlint/swiftlint.rb', line 29 def swiftlint_path @swiftlint_path or default_swiftlint_path end |