Method: CodeFormatter::SwiftLintFormatter#format

Defined in:
lib/code_formatter/formatters/swift_lint_formatter.rb

#formatObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/code_formatter/formatters/swift_lint_formatter.rb', line 9

def format(*)
  unless Environment.exist? 'swiftlint'
    warn "warning: [swiftlint] not found (to install it run 'brew install swiftlint')"
    return
  end

  create_config do |file|
    system("swiftlint autocorrect --path #{path} --config #{file.path}")
    system("swiftlint --path #{path} --config #{file.path}")
  end
end