Sha256: 0a929b280c963353af99dd9251927399031c92c8624cb7b4d902a8c4bf671559
Contents?: true
Size: 888 Bytes
Versions: 3
Compression:
Stored size: 888 Bytes
Contents
module Overcommit::Hook::PreCommit # Runs `haml-lint` against any modified HAML files. class HamlLint < Base def run unless in_path?('haml-lint') return :warn, 'haml-lint not installed -- run `gem install haml-lint`' end result = execute(%w[haml-lint] + applicable_files) return :pass if result.success? # Keep lines from the output for files that we actually modified error_lines, warning_lines = result.stdout.split("\n").partition do |output_line| if match = output_line.match(/^([^:]+):(\d+)/) file = match[1] line = match[2] end modified_lines(file).include?(line.to_i) end return :fail, error_lines.join("\n") unless error_lines.empty? [:warn, "Modified files have lints (on lines you didn't modify)\n" << warning_lines.join("\n")] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
overcommit-0.17.0 | lib/overcommit/hook/pre_commit/haml_lint.rb |
overcommit-0.16.0 | lib/overcommit/hook/pre_commit/haml_lint.rb |
overcommit-0.15.0 | lib/overcommit/hook/pre_commit/haml_lint.rb |