class CodeFormatter::SwiftFormatFormatter
Public Instance Methods
files_filter()
click to toggle source
# File lib/code_formatter/formatters/swift_format_formatter.rb, line 18 def files_filter "'*.swift'" end
format_files(files)
click to toggle source
# File lib/code_formatter/formatters/swift_format_formatter.rb, line 8 def format_files(files) disabled = disabled_rules.join(',') enabled = enabled_rules.join(',') `swiftformat #{files.join(' ')} --disable #{disabled} --enable #{enabled}` end
shell_command()
click to toggle source
# File lib/code_formatter/formatters/swift_format_formatter.rb, line 14 def shell_command 'swiftformat' end
Private Instance Methods
disabled_rules()
click to toggle source
@return [[String]] disabled rules
# File lib/code_formatter/formatters/swift_format_formatter.rb, line 30 def disabled_rules rules_config['disabled_rules'].map(&:strip) end
enabled_rules()
click to toggle source
@return [[String]] enabled rules
# File lib/code_formatter/formatters/swift_format_formatter.rb, line 25 def enabled_rules rules_config['enabled_rules'].map(&:strip) end
rules_config()
click to toggle source
# File lib/code_formatter/formatters/swift_format_formatter.rb, line 34 def rules_config rules_file = File.expand_path('../../resources/swiftformat_rules.yml', __FILE__) YAML.load_file(rules_file) end