overcommit 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/overcommit/plugins/pre_commit/haml_style.rb +34 -0
- data/lib/overcommit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffbc74c18b780690aa2bc17d03f761587e25af5f
|
4
|
+
data.tar.gz: 63e054091b6b4ce79382cc006ad6ced1a1854feb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44b1113f451e96e94a147eaef737b0a42f728bb360a9e738da18d723ea6df2f86a435e163fee99989d27c94e3e11d9833c2bef53599ffc238499f8bd36744db9
|
7
|
+
data.tar.gz: 5048811fc9f795f457be2e98bc27465063beb295495954cc50038d196fce4e77f36b6529de78b83d4d2529349cb0164212282203f87ba4b7745d26a4c9badec9
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Overcommit::GitHook
|
2
|
+
class HamlStyle < HookSpecificCheck
|
3
|
+
include HookRegistry
|
4
|
+
file_types :haml
|
5
|
+
|
6
|
+
def run_check
|
7
|
+
unless in_path?('haml-lint')
|
8
|
+
return :warn, 'haml-lint not installed -- run `gem install haml-lint`'
|
9
|
+
end
|
10
|
+
|
11
|
+
paths_to_staged_files = Hash[staged.map { |s| [s.path, s] }]
|
12
|
+
staged_files = paths_to_staged_files.keys
|
13
|
+
|
14
|
+
output = `haml-lint #{staged_files.join(' ')} 2>&1`
|
15
|
+
return :good if $?.success?
|
16
|
+
|
17
|
+
# Keep lines from the output for files that we actually modified
|
18
|
+
error_lines, warning_lines = output.lines.partition do |output_line|
|
19
|
+
if match = output_line.match(/^([^:]+):(\d+)/)
|
20
|
+
file = match[1]
|
21
|
+
line = match[2]
|
22
|
+
end
|
23
|
+
unless paths_to_staged_files[file]
|
24
|
+
return :warn, "Unexpected output from haml-lint:\n#{output}"
|
25
|
+
end
|
26
|
+
paths_to_staged_files[file].modified_lines.include?(line.to_i)
|
27
|
+
end
|
28
|
+
|
29
|
+
return :bad, error_lines.join unless error_lines.empty?
|
30
|
+
return :warn, "Modified files have lints (on lines you didn't modify)\n" <<
|
31
|
+
warning_lines.join
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/overcommit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overcommit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Causes Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/overcommit/plugins/commit_msg/hard_tabs.rb
|
43
43
|
- lib/overcommit/plugins/commit_msg/text_width.rb
|
44
44
|
- lib/overcommit/plugins/pre_commit/js_console_log.rb
|
45
|
+
- lib/overcommit/plugins/pre_commit/haml_style.rb
|
45
46
|
- lib/overcommit/plugins/pre_commit/ruby_syntax.rb
|
46
47
|
- lib/overcommit/plugins/pre_commit/js_syntax.rb
|
47
48
|
- lib/overcommit/plugins/pre_commit/yaml_syntax.rb
|