Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@AliSoftware
AliSoftware / lint_snippets_in_markdown.rb
Last active February 9, 2019 16:52
Runs SwiftLint on all code snippets found in a markdown file
#!/usr/bin/env ruby
require 'tmpdir'
require 'open3'
# The first parameter is supposed to be the path to the markdown file
input_file = ARGV.first
config_file = ARGV[1] || '.swiftlint.yml'
config_param = File.exist?(config_file) ? " --config #{File.realpath(config_file)}" : ''