class CodeFormatter::SwiftLintFormatter
Public Instance Methods
files_filter()
click to toggle source
# File lib/code_formatter/formatters/swift_lint_formatter.rb, line 20 def files_filter "'*.swift'" end
format_files(_)
click to toggle source
# File lib/code_formatter/formatters/swift_lint_formatter.rb, line 9 def format_files(_) create_config do |file| system("swiftlint autocorrect --path #{path} --config #{file.path}") system("swiftlint --path #{path} --config #{file.path}") end end
shell_command()
click to toggle source
# File lib/code_formatter/formatters/swift_lint_formatter.rb, line 16 def shell_command 'swiftlint' end
Private Instance Methods
create_config() { |file| ... }
click to toggle source
# File lib/code_formatter/formatters/swift_lint_formatter.rb, line 26 def create_config file = Tempfile.new(%w[swiftlint .yml]) begin file.write(swiftlint_config) file.close yield file if block_given? ensure file.unlink end end
swiftlint_config()
click to toggle source
# File lib/code_formatter/formatters/swift_lint_formatter.rb, line 37 def swiftlint_config rules_file = File.expand_path('../../resources/swiftlint.yml', __FILE__) yaml_hash = YAML.load_file(rules_file) yaml_hash['included'] = config.included_files yaml_hash['excluded'] = config.excluded_files yaml_hash.to_yaml end