overcommit 0.1.5 → 0.1.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/hook_specific_check.rb +9 -7
- data/lib/overcommit/plugins/commit_msg/release_note.rb +12 -1
- data/lib/overcommit/plugins/pre_commit/coffee_lint.rb +15 -0
- data/lib/overcommit/plugins/pre_commit/python_flake8.rb +15 -0
- data/lib/overcommit/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8705a9603730e08028af8ed52da1d89b34701870
|
|
4
|
+
data.tar.gz: 36da43665b7fc82ac9e527a5bed18fe26343d072
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02a1281d19da82fa562078b4c783f652b95e3eaa082cd938aa4507ff347e88206df91a892695084d78902340d6fed1ef71191a7c8635a415466bbf7d807ea785
|
|
7
|
+
data.tar.gz: 69850c03a18dd3831710074f0985c236f50b570f10a866fcae16314570a9b35594c5153df165078c731548292b98197616809a17f7740160695a7e7f7fc2f872
|
|
@@ -66,14 +66,16 @@ module Overcommit
|
|
|
66
66
|
system("which #{cmd} &> /dev/null")
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
def
|
|
70
|
-
@
|
|
71
|
-
|
|
72
|
-
fail 'Not running in the context of a commit message'
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
File.readlines(@arguments[0])
|
|
69
|
+
def commit_message_file
|
|
70
|
+
unless @arguments[0] && ::File.exist?(@arguments[0])
|
|
71
|
+
fail 'Not running in the context of a commit message'
|
|
76
72
|
end
|
|
73
|
+
|
|
74
|
+
@arguments[0]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def commit_message
|
|
78
|
+
@commit_message ||= ::IO.readlines(commit_message_file)
|
|
77
79
|
end
|
|
78
80
|
|
|
79
81
|
# Strip comments and diff (from git-commit --verbose)
|
|
@@ -5,10 +5,21 @@ module Overcommit::GitHook
|
|
|
5
5
|
EMPTY_RELEASE_NOTE = /^release notes?\s*[:.]?\n{2,}/im
|
|
6
6
|
def run_check
|
|
7
7
|
if user_commit_message.join =~ EMPTY_RELEASE_NOTE
|
|
8
|
-
|
|
8
|
+
strip_release_note
|
|
9
|
+
return :warn, 'Empty release note found, automatically removed'
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
:good
|
|
12
13
|
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def strip_release_note
|
|
18
|
+
stripped_message = user_commit_message.join.sub(EMPTY_RELEASE_NOTE, '')
|
|
19
|
+
|
|
20
|
+
::File.open(commit_message_file, 'w') do |file|
|
|
21
|
+
file.write(stripped_message)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
13
24
|
end
|
|
14
25
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Overcommit::GitHook
|
|
2
|
+
class CoffeeLint < HookSpecificCheck
|
|
3
|
+
include HookRegistry
|
|
4
|
+
file_type :coffee
|
|
5
|
+
|
|
6
|
+
def run_check
|
|
7
|
+
unless in_path? 'coffeelint'
|
|
8
|
+
return :warn, 'Run `npm install -g coffeelint`'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
output = `coffeelint --quiet #{(staged.join(' '))}`.split("\n")
|
|
12
|
+
return ($?.success? ? :good : :bad), output
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Overcommit::GitHook
|
|
2
|
+
class PythonFlake8 < HookSpecificCheck
|
|
3
|
+
include HookRegistry
|
|
4
|
+
file_type :py
|
|
5
|
+
|
|
6
|
+
def run_check
|
|
7
|
+
unless in_path? 'flake8'
|
|
8
|
+
return :warn, 'Run `pip install flake8`'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
output = `flake8 #{(staged.join(' '))}`.split("\n")
|
|
12
|
+
return ($?.success? ? :good : :bad), output
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/overcommit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: overcommit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Causes Engineering
|
|
@@ -47,11 +47,13 @@ files:
|
|
|
47
47
|
- lib/overcommit/plugins/commit_msg/trailing_period.rb
|
|
48
48
|
- lib/overcommit/plugins/pre_commit/author_name.rb
|
|
49
49
|
- lib/overcommit/plugins/pre_commit/causes_email.rb
|
|
50
|
+
- lib/overcommit/plugins/pre_commit/coffee_lint.rb
|
|
50
51
|
- lib/overcommit/plugins/pre_commit/css_linter.rb
|
|
51
52
|
- lib/overcommit/plugins/pre_commit/erb_syntax.rb
|
|
52
53
|
- lib/overcommit/plugins/pre_commit/haml_syntax.rb
|
|
53
54
|
- lib/overcommit/plugins/pre_commit/js_console_log.rb
|
|
54
55
|
- lib/overcommit/plugins/pre_commit/js_syntax.rb
|
|
56
|
+
- lib/overcommit/plugins/pre_commit/python_flake8.rb
|
|
55
57
|
- lib/overcommit/plugins/pre_commit/restricted_paths.rb
|
|
56
58
|
- lib/overcommit/plugins/pre_commit/ruby_syntax.rb
|
|
57
59
|
- lib/overcommit/plugins/pre_commit/scss_lint.rb
|