overcommit 0.1.6 → 0.1.7
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.
- data/bin/hooks/post-merge +2 -2
- data/lib/overcommit/cli.rb +1 -1
- data/lib/overcommit/git_hook.rb +1 -1
- data/lib/overcommit/hook_specific_check.rb +9 -5
- data/lib/overcommit/logger.rb +19 -7
- data/lib/overcommit/plugins/commit_msg/hard_tabs.rb +14 -0
- data/lib/overcommit/plugins/commit_msg/release_note.rb +2 -2
- data/lib/overcommit/plugins/commit_msg/russian_novel.rb +1 -1
- data/lib/overcommit/plugins/commit_msg/single_line_subject.rb +13 -0
- data/lib/overcommit/plugins/commit_msg/text_width.rb +2 -2
- data/lib/overcommit/plugins/commit_msg/trailing_period.rb +1 -1
- data/lib/overcommit/reporter.rb +2 -2
- data/lib/overcommit/version.rb +1 -1
- metadata +44 -38
- checksums.yaml +0 -7
data/bin/hooks/post-merge
CHANGED
@@ -9,12 +9,12 @@ submodule_status.each_line do |line|
|
|
9
9
|
|
10
10
|
if line.match(/^\+/)
|
11
11
|
# The second word is the submodule directory.
|
12
|
-
updated_submodules << line.split(
|
12
|
+
updated_submodules << line.split(' ')[1]
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
if updated_submodules.length > 0
|
17
|
-
puts
|
17
|
+
puts 'The following git submodules are out of date:'
|
18
18
|
updated_submodules.each do |submodule|
|
19
19
|
puts "\t#{submodule}"
|
20
20
|
end
|
data/lib/overcommit/cli.rb
CHANGED
data/lib/overcommit/git_hook.rb
CHANGED
@@ -28,6 +28,10 @@ module Overcommit
|
|
28
28
|
def skippable?
|
29
29
|
!required
|
30
30
|
end
|
31
|
+
|
32
|
+
def friendly_name
|
33
|
+
Overcommit::Utils.underscorize name.to_s.split('::').last
|
34
|
+
end
|
31
35
|
end
|
32
36
|
|
33
37
|
def initialize(*args)
|
@@ -35,7 +39,7 @@ module Overcommit
|
|
35
39
|
end
|
36
40
|
|
37
41
|
def name
|
38
|
-
|
42
|
+
self.class.friendly_name
|
39
43
|
end
|
40
44
|
|
41
45
|
def skip?
|
@@ -74,13 +78,13 @@ module Overcommit
|
|
74
78
|
@arguments[0]
|
75
79
|
end
|
76
80
|
|
77
|
-
def
|
78
|
-
@
|
81
|
+
def raw_commit_message
|
82
|
+
@raw_commit_message ||= ::IO.readlines(commit_message_file)
|
79
83
|
end
|
80
84
|
|
81
85
|
# Strip comments and diff (from git-commit --verbose)
|
82
|
-
def
|
83
|
-
@
|
86
|
+
def commit_message
|
87
|
+
@commit_message ||= raw_commit_message.
|
84
88
|
reject { |line| line =~ /^#/ }.
|
85
89
|
take_while { |line| !line.start_with?('diff --git') }
|
86
90
|
end
|
data/lib/overcommit/logger.rb
CHANGED
@@ -5,32 +5,44 @@ module Overcommit
|
|
5
5
|
class Logger
|
6
6
|
include Singleton
|
7
7
|
|
8
|
+
attr_accessor :output
|
9
|
+
|
8
10
|
def partial(*args)
|
9
|
-
print *args
|
11
|
+
out.print *args
|
10
12
|
end
|
11
13
|
|
12
14
|
def log(*args)
|
13
|
-
puts *args
|
15
|
+
out.puts *args
|
14
16
|
end
|
15
17
|
|
16
18
|
def bold(str)
|
17
|
-
|
19
|
+
color('1;37', str)
|
18
20
|
end
|
19
21
|
|
20
22
|
def error(str)
|
21
|
-
|
23
|
+
color(31, str)
|
22
24
|
end
|
23
25
|
|
24
26
|
def success(str)
|
25
|
-
|
27
|
+
color(32, str)
|
26
28
|
end
|
27
29
|
|
28
30
|
def warning(str)
|
29
|
-
|
31
|
+
color(33, str)
|
30
32
|
end
|
31
33
|
|
32
34
|
def notice(str)
|
33
|
-
|
35
|
+
color('1;33', str)
|
36
|
+
end
|
37
|
+
|
38
|
+
def out
|
39
|
+
self.output ||= $stdout
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def color(code, str)
|
45
|
+
log(out.isatty ? "\033[#{code}m#{str}\033[0m" : str)
|
34
46
|
end
|
35
47
|
end
|
36
48
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Overcommit::GitHook
|
2
|
+
class HardTabs < HookSpecificCheck
|
3
|
+
include HookRegistry
|
4
|
+
|
5
|
+
def run_check
|
6
|
+
# Catches hard tabs entered by the user (not auto-generated)
|
7
|
+
if commit_message.join.index /\t/
|
8
|
+
return :warn, "Don't use hard tabs in commit messages"
|
9
|
+
end
|
10
|
+
|
11
|
+
:good
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -4,7 +4,7 @@ module Overcommit::GitHook
|
|
4
4
|
|
5
5
|
EMPTY_RELEASE_NOTE = /^release notes?\s*[:.]?\n{2,}/im
|
6
6
|
def run_check
|
7
|
-
if
|
7
|
+
if commit_message.join =~ EMPTY_RELEASE_NOTE
|
8
8
|
strip_release_note
|
9
9
|
return :warn, 'Empty release note found, automatically removed'
|
10
10
|
end
|
@@ -15,7 +15,7 @@ module Overcommit::GitHook
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def strip_release_note
|
18
|
-
stripped_message =
|
18
|
+
stripped_message = commit_message.join.sub(EMPTY_RELEASE_NOTE, '')
|
19
19
|
|
20
20
|
::File.open(commit_message_file, 'w') do |file|
|
21
21
|
file.write(stripped_message)
|
@@ -6,7 +6,7 @@ module Overcommit::GitHook
|
|
6
6
|
|
7
7
|
RUSSIAN_NOVEL_LENGTH = 30
|
8
8
|
def run_check
|
9
|
-
if
|
9
|
+
if commit_message.length > RUSSIAN_NOVEL_LENGTH
|
10
10
|
return :warn, 'You seem to have authored a Russian novel; congratulations!'
|
11
11
|
end
|
12
12
|
|
@@ -3,11 +3,11 @@ module Overcommit::GitHook
|
|
3
3
|
include HookRegistry
|
4
4
|
|
5
5
|
def run_check
|
6
|
-
if
|
6
|
+
if commit_message.first.size > 60
|
7
7
|
return :warn, 'Please keep the subject < ~60 characters'
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
commit_message.each do |line|
|
11
11
|
chomped = line.chomp
|
12
12
|
if chomped.size > 72
|
13
13
|
return :warn, "> 72 characters, please hard wrap: '#{chomped}'"
|
data/lib/overcommit/reporter.rb
CHANGED
@@ -3,12 +3,12 @@ module Overcommit
|
|
3
3
|
def initialize(name, checks)
|
4
4
|
@name = name
|
5
5
|
@checks = checks
|
6
|
-
@width =
|
6
|
+
@width = 60 - (@checks.map { |s| s.friendly_name.length }.max || 0)
|
7
7
|
@results = []
|
8
8
|
end
|
9
9
|
|
10
10
|
def with_status(check, &block)
|
11
|
-
title = " Checking #{check.name}
|
11
|
+
title = " Checking #{check.name}"
|
12
12
|
log.partial title unless check.stealth?
|
13
13
|
|
14
14
|
status, output = yield
|
data/lib/overcommit/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,30 @@
|
|
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.7
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Causes Engineering
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rspec
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
30
|
description: Overcommit is a utility to install and extend Git hooks
|
@@ -31,74 +34,77 @@ executables:
|
|
31
34
|
extensions: []
|
32
35
|
extra_rdoc_files: []
|
33
36
|
files:
|
34
|
-
- lib/overcommit/cli.rb
|
35
|
-
- lib/overcommit/configuration.rb
|
36
|
-
- lib/overcommit/errors.rb
|
37
|
-
- lib/overcommit/git_hook.rb
|
38
|
-
- lib/overcommit/hook_specific_check.rb
|
39
|
-
- lib/overcommit/hooks/commit_msg.rb
|
40
|
-
- lib/overcommit/hooks/pre_commit.rb
|
41
|
-
- lib/overcommit/installer.rb
|
42
37
|
- lib/overcommit/logger.rb
|
43
|
-
- lib/overcommit/
|
44
|
-
- lib/overcommit/
|
38
|
+
- lib/overcommit/installer.rb
|
39
|
+
- lib/overcommit/hook_specific_check.rb
|
40
|
+
- lib/overcommit/reporter.rb
|
41
|
+
- lib/overcommit/plugins/commit_msg/hard_tabs.rb
|
45
42
|
- lib/overcommit/plugins/commit_msg/russian_novel.rb
|
43
|
+
- lib/overcommit/plugins/commit_msg/release_note.rb
|
44
|
+
- lib/overcommit/plugins/commit_msg/single_line_subject.rb
|
45
|
+
- lib/overcommit/plugins/commit_msg/change_id.rb
|
46
46
|
- lib/overcommit/plugins/commit_msg/text_width.rb
|
47
47
|
- lib/overcommit/plugins/commit_msg/trailing_period.rb
|
48
|
-
- lib/overcommit/plugins/pre_commit/
|
48
|
+
- lib/overcommit/plugins/pre_commit/js_syntax.rb
|
49
|
+
- lib/overcommit/plugins/pre_commit/test_history.rb
|
50
|
+
- lib/overcommit/plugins/pre_commit/yaml_syntax.rb
|
51
|
+
- lib/overcommit/plugins/pre_commit/python_flake8.rb
|
49
52
|
- lib/overcommit/plugins/pre_commit/causes_email.rb
|
50
|
-
- lib/overcommit/plugins/pre_commit/
|
51
|
-
- lib/overcommit/plugins/pre_commit/
|
53
|
+
- lib/overcommit/plugins/pre_commit/js_console_log.rb
|
54
|
+
- lib/overcommit/plugins/pre_commit/author_name.rb
|
52
55
|
- lib/overcommit/plugins/pre_commit/erb_syntax.rb
|
56
|
+
- lib/overcommit/plugins/pre_commit/scss_lint.rb
|
57
|
+
- lib/overcommit/plugins/pre_commit/coffee_lint.rb
|
53
58
|
- lib/overcommit/plugins/pre_commit/haml_syntax.rb
|
54
|
-
- lib/overcommit/plugins/pre_commit/
|
55
|
-
- lib/overcommit/plugins/pre_commit/js_syntax.rb
|
56
|
-
- lib/overcommit/plugins/pre_commit/python_flake8.rb
|
59
|
+
- lib/overcommit/plugins/pre_commit/whitespace.rb
|
57
60
|
- lib/overcommit/plugins/pre_commit/restricted_paths.rb
|
58
61
|
- lib/overcommit/plugins/pre_commit/ruby_syntax.rb
|
59
|
-
- lib/overcommit/plugins/pre_commit/
|
60
|
-
- lib/overcommit/
|
61
|
-
- lib/overcommit/
|
62
|
-
- lib/overcommit/
|
63
|
-
- lib/overcommit/
|
64
|
-
- lib/overcommit/utils.rb
|
62
|
+
- lib/overcommit/plugins/pre_commit/css_linter.rb
|
63
|
+
- lib/overcommit/git_hook.rb
|
64
|
+
- lib/overcommit/errors.rb
|
65
|
+
- lib/overcommit/cli.rb
|
66
|
+
- lib/overcommit/configuration.rb
|
65
67
|
- lib/overcommit/version.rb
|
68
|
+
- lib/overcommit/hooks/pre_commit.rb
|
69
|
+
- lib/overcommit/hooks/commit_msg.rb
|
70
|
+
- lib/overcommit/utils.rb
|
66
71
|
- lib/overcommit.rb
|
67
|
-
- bin/hooks/commit-msg
|
68
|
-
- bin/hooks/post-checkout
|
69
|
-
- bin/hooks/post-merge
|
70
|
-
- bin/hooks/pre-commit
|
71
|
-
- bin/hooks/prepare-commit-msg
|
72
72
|
- bin/overcommit
|
73
73
|
- bin/run-hook
|
74
|
+
- bin/scripts/jshint.js
|
75
|
+
- bin/scripts/index-tags
|
74
76
|
- bin/scripts/csslint-rhino.js
|
75
77
|
- bin/scripts/gerrit-change-id
|
76
|
-
- bin/scripts/index-tags
|
77
|
-
- bin/scripts/jshint.js
|
78
78
|
- bin/scripts/jshint_runner.js
|
79
|
+
- bin/hooks/commit-msg
|
80
|
+
- bin/hooks/pre-commit
|
81
|
+
- bin/hooks/post-merge
|
82
|
+
- bin/hooks/post-checkout
|
83
|
+
- bin/hooks/prepare-commit-msg
|
79
84
|
- config/templates.yml
|
80
85
|
homepage: http://github.com/causes/overcommit
|
81
86
|
licenses:
|
82
87
|
- MIT
|
83
|
-
metadata: {}
|
84
88
|
post_install_message:
|
85
89
|
rdoc_options: []
|
86
90
|
require_paths:
|
87
91
|
- lib
|
88
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
89
94
|
requirements:
|
90
|
-
- - '>='
|
95
|
+
- - ! '>='
|
91
96
|
- !ruby/object:Gem::Version
|
92
97
|
version: '0'
|
93
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
94
100
|
requirements:
|
95
|
-
- - '>='
|
101
|
+
- - ! '>='
|
96
102
|
- !ruby/object:Gem::Version
|
97
103
|
version: '0'
|
98
104
|
requirements: []
|
99
105
|
rubyforge_project:
|
100
|
-
rubygems_version:
|
106
|
+
rubygems_version: 1.8.23
|
101
107
|
signing_key:
|
102
|
-
specification_version:
|
108
|
+
specification_version: 3
|
103
109
|
summary: Opinionated Git hook manager
|
104
110
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 8705a9603730e08028af8ed52da1d89b34701870
|
4
|
-
data.tar.gz: 36da43665b7fc82ac9e527a5bed18fe26343d072
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 02a1281d19da82fa562078b4c783f652b95e3eaa082cd938aa4507ff347e88206df91a892695084d78902340d6fed1ef71191a7c8635a415466bbf7d807ea785
|
7
|
-
data.tar.gz: 69850c03a18dd3831710074f0985c236f50b570f10a866fcae16314570a9b35594c5153df165078c731548292b98197616809a17f7740160695a7e7f7fc2f872
|