overcommit 0.52.0 → 0.55.0
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/config/default.yml +9 -2
- data/lib/overcommit/exceptions.rb +19 -16
- data/lib/overcommit/git_repo.rb +10 -9
- data/lib/overcommit/hook/base.rb +2 -1
- data/lib/overcommit/hook/pre_commit/author_name.rb +2 -2
- data/lib/overcommit/hook/pre_commit/php_cs.rb +6 -13
- data/lib/overcommit/hook/pre_commit/pronto.rb +3 -14
- data/lib/overcommit/hook/pre_push/base.rb +5 -0
- data/lib/overcommit/hook/pre_push/pronto.rb +12 -0
- data/lib/overcommit/hook/prepare_commit_msg/replace_branch.rb +1 -1
- data/lib/overcommit/hook/shared/pronto.rb +21 -0
- data/lib/overcommit/hook_context/pre_push.rb +2 -2
- data/lib/overcommit/printer.rb +1 -0
- data/lib/overcommit/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a524e83e8f2a0a620f84817c6001626f7c9ddebcc9e539371b1efbab310d7493
|
4
|
+
data.tar.gz: 7ab2d3ac91f72a49dc5d549c7ae0e801d03db8898a1927e59d61b1bb34cae540
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4f16534e0c4173f388aecf99d35a16cc5672cbac25f3e3abf524bd1a3c581c9afa3dd391995d70d122fc85bf5b7488ec414413be9b93f8ea35dc83967335eab
|
7
|
+
data.tar.gz: a41eca8c55b8643cd248a1cebd619ad6984d7c257bd3477932e72506b436866b8ccdb7123b8e45bc7ebdef4d5a7618bf9239fb4162ca0bb3d804c29a4a867685
|
data/config/default.yml
CHANGED
@@ -338,7 +338,7 @@ PreCommit:
|
|
338
338
|
keywords: ['FContext','FDescribe','FIt','FMeasure','FSpecify','FWhen']
|
339
339
|
|
340
340
|
GoFmt:
|
341
|
-
enabled:
|
341
|
+
enabled: false
|
342
342
|
description: 'Fix with go fmt'
|
343
343
|
required_executable: 'go'
|
344
344
|
command: ['go', 'fmt']
|
@@ -885,7 +885,7 @@ PreCommit:
|
|
885
885
|
enabled: false
|
886
886
|
description: 'Analyze with YAMLlint'
|
887
887
|
required_executable: 'yamllint'
|
888
|
-
flags: ['--format=parsable']
|
888
|
+
flags: ['--format=parsable', '--strict']
|
889
889
|
install_command: 'pip install yamllint'
|
890
890
|
include:
|
891
891
|
- '**/*.yaml'
|
@@ -1297,6 +1297,13 @@ PrePush:
|
|
1297
1297
|
flags: ['--bootstrap', 'vendor/autoload.php', 'tests']
|
1298
1298
|
install_command: 'composer require --dev phpunit/phpunit'
|
1299
1299
|
|
1300
|
+
Pronto:
|
1301
|
+
enabled: false
|
1302
|
+
description: 'Analyzing with pronto'
|
1303
|
+
required_executable: 'pronto'
|
1304
|
+
install_command: 'gem install pronto'
|
1305
|
+
flags: ['run', '--exit-code']
|
1306
|
+
|
1300
1307
|
ProtectedBranches:
|
1301
1308
|
enabled: false
|
1302
1309
|
description: 'Check for illegal pushes to protected branches'
|
@@ -1,52 +1,55 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Overcommit::Exceptions
|
4
|
+
# Base error class.
|
5
|
+
class Error < StandardError; end
|
6
|
+
|
4
7
|
# Raised when a {Configuration} could not be loaded from a file.
|
5
|
-
class ConfigurationError <
|
8
|
+
class ConfigurationError < Error; end
|
6
9
|
|
7
10
|
# Raised when the Overcommit configuration file signature has changed.
|
8
|
-
class ConfigurationSignatureChanged <
|
11
|
+
class ConfigurationSignatureChanged < Error; end
|
9
12
|
|
10
13
|
# Raised when trying to read/write to/from the local repo git config fails.
|
11
|
-
class GitConfigError <
|
14
|
+
class GitConfigError < Error; end
|
12
15
|
|
13
16
|
# Raised when there was a problem reading submodule information for a repo.
|
14
|
-
class GitSubmoduleError <
|
17
|
+
class GitSubmoduleError < Error; end
|
15
18
|
|
16
19
|
# Raised when there was a problem reading git revision information with `rev-list`.
|
17
|
-
class GitRevListError <
|
20
|
+
class GitRevListError < Error; end
|
18
21
|
|
19
22
|
# Raised when a {HookContext} is unable to setup the environment before a run.
|
20
|
-
class HookSetupFailed <
|
23
|
+
class HookSetupFailed < Error; end
|
21
24
|
|
22
25
|
# Raised when a {HookContext} is unable to clean the environment after a run.
|
23
|
-
class HookCleanupFailed <
|
26
|
+
class HookCleanupFailed < Error; end
|
24
27
|
|
25
28
|
# Raised when a hook run was cancelled by the user.
|
26
|
-
class HookCancelled <
|
29
|
+
class HookCancelled < Error; end
|
27
30
|
|
28
31
|
# Raised when a hook could not be loaded by a {HookRunner}.
|
29
|
-
class HookLoadError <
|
32
|
+
class HookLoadError < Error; end
|
30
33
|
|
31
34
|
# Raised when a {HookRunner} could not be loaded.
|
32
|
-
class HookContextLoadError <
|
35
|
+
class HookContextLoadError < Error; end
|
33
36
|
|
34
37
|
# Raised when a pipe character is used in the `execute` helper, as this was
|
35
38
|
# likely used in error.
|
36
|
-
class InvalidCommandArgs <
|
39
|
+
class InvalidCommandArgs < Error; end
|
37
40
|
|
38
41
|
# Raised when an installation target is not a valid git repository.
|
39
|
-
class InvalidGitRepo <
|
42
|
+
class InvalidGitRepo < Error; end
|
40
43
|
|
41
44
|
# Raised when a hook was defined incorrectly.
|
42
|
-
class InvalidHookDefinition <
|
45
|
+
class InvalidHookDefinition < Error; end
|
43
46
|
|
44
47
|
# Raised when one or more hook plugin signatures have changed.
|
45
|
-
class InvalidHookSignature <
|
48
|
+
class InvalidHookSignature < Error; end
|
46
49
|
|
47
50
|
# Raised when there is a problem processing output into {Hook::Messages}s.
|
48
|
-
class MessageProcessingError <
|
51
|
+
class MessageProcessingError < Error; end
|
49
52
|
|
50
53
|
# Raised when an installation target already contains non-Overcommit hooks.
|
51
|
-
class PreExistingHooks <
|
54
|
+
class PreExistingHooks < Error; end
|
52
55
|
end
|
data/lib/overcommit/git_repo.rb
CHANGED
@@ -109,15 +109,16 @@ module Overcommit
|
|
109
109
|
# @return [Array<String>] list of absolute file paths
|
110
110
|
def list_files(paths = [], options = {})
|
111
111
|
ref = options[:ref] || 'HEAD'
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
112
|
+
|
113
|
+
result = Overcommit::Utils.execute(%W[git ls-tree --name-only #{ref}], args: paths)
|
114
|
+
unless result.success?
|
115
|
+
raise Overcommit::Exceptions::Error,
|
116
|
+
"Error listing files. EXIT STATUS(es): #{result.statuses}.\n" \
|
117
|
+
"STDOUT(s): #{result.stdouts}.\n" \
|
118
|
+
"STDERR(s): #{result.stderrs}."
|
119
|
+
end
|
120
|
+
|
121
|
+
result.stdout.split(/\n/).
|
121
122
|
map { |relative_file| File.expand_path(relative_file) }.
|
122
123
|
reject { |file| File.directory?(file) } # Exclude submodule directories
|
123
124
|
end
|
data/lib/overcommit/hook/base.rb
CHANGED
@@ -12,9 +12,9 @@ module Overcommit::Hook::PreCommit
|
|
12
12
|
result.stdout.chomp
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
if name.empty?
|
16
16
|
return :fail,
|
17
|
-
"Author must
|
17
|
+
"Author name must be non-0 in length.\n" \
|
18
18
|
'Set your name with `git config --global user.name "Your Name"` ' \
|
19
19
|
'or via the GIT_AUTHOR_NAME environment variable'
|
20
20
|
end
|
@@ -12,21 +12,14 @@ module Overcommit::Hook::PreCommit
|
|
12
12
|
def run
|
13
13
|
messages = []
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
# Discard the csv header
|
21
|
-
rows.shift
|
22
|
-
|
23
|
-
# Push each of the errors in the particular file into the array
|
24
|
-
rows.map do |row|
|
25
|
-
messages << row
|
26
|
-
end
|
27
|
-
end
|
15
|
+
result = execute(command, args: applicable_files)
|
16
|
+
if result.status
|
17
|
+
messages = result.stdout.split("\n")
|
18
|
+
# Discard the csv header
|
19
|
+
messages.shift
|
28
20
|
end
|
29
21
|
|
22
|
+
return :fail if messages.empty? && !result.success?
|
30
23
|
return :pass if messages.empty?
|
31
24
|
|
32
25
|
parse_messages(messages)
|
@@ -1,23 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'overcommit/hook/shared/pronto'
|
4
|
+
|
3
5
|
module Overcommit::Hook::PreCommit
|
4
6
|
# Runs `pronto`
|
5
7
|
#
|
6
8
|
# @see https://github.com/mmozuras/pronto
|
7
9
|
class Pronto < Base
|
8
|
-
|
9
|
-
type.include?('E') ? :error : :warning
|
10
|
-
end
|
11
|
-
|
12
|
-
def run
|
13
|
-
result = execute(command)
|
14
|
-
return :pass if result.success?
|
15
|
-
|
16
|
-
extract_messages(
|
17
|
-
result.stdout.split("\n"),
|
18
|
-
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+) (?<type>[^ ]+)/,
|
19
|
-
MESSAGE_TYPE_CATEGORIZER,
|
20
|
-
)
|
21
|
-
end
|
10
|
+
include Overcommit::Hook::Shared::Pronto
|
22
11
|
end
|
23
12
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'forwardable'
|
4
|
+
require 'overcommit/utils/messages_utils'
|
4
5
|
|
5
6
|
module Overcommit::Hook::PrePush
|
6
7
|
# Functionality common to all pre-push hooks.
|
@@ -17,6 +18,10 @@ module Overcommit::Hook::PrePush
|
|
17
18
|
|
18
19
|
private
|
19
20
|
|
21
|
+
def extract_messages(*args)
|
22
|
+
Overcommit::Utils::MessagesUtils.extract_messages(*args)
|
23
|
+
end
|
24
|
+
|
20
25
|
def exclude_remotes
|
21
26
|
@config['exclude_remotes'] || []
|
22
27
|
end
|
@@ -17,7 +17,7 @@ module Overcommit::Hook::PrepareCommitMsg
|
|
17
17
|
Overcommit::Utils.log.debug("Writing #{commit_message_filename} with #{new_template}")
|
18
18
|
|
19
19
|
modify_commit_message do |old_contents|
|
20
|
-
"#{new_template}
|
20
|
+
"#{new_template} #{old_contents}"
|
21
21
|
end
|
22
22
|
|
23
23
|
:pass
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Overcommit::Hook::Shared
|
4
|
+
# Shared code used by all Pronto hooks. Runs pronto linter.
|
5
|
+
module Pronto
|
6
|
+
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
|
7
|
+
type.include?('E') ? :error : :warning
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
result = execute(command)
|
12
|
+
return :pass if result.success?
|
13
|
+
|
14
|
+
extract_messages(
|
15
|
+
result.stdout.split("\n"),
|
16
|
+
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+) (?<type>[^ ]+)/,
|
17
|
+
MESSAGE_TYPE_CATEGORIZER,
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/overcommit/printer.rb
CHANGED
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.
|
4
|
+
version: 0.55.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: childprocess
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 0.6.3
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '5'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 0.6.3
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '5'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: iniparse
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,6 +216,7 @@ files:
|
|
216
216
|
- lib/overcommit/hook/pre_push/golangci_lint.rb
|
217
217
|
- lib/overcommit/hook/pre_push/minitest.rb
|
218
218
|
- lib/overcommit/hook/pre_push/php_unit.rb
|
219
|
+
- lib/overcommit/hook/pre_push/pronto.rb
|
219
220
|
- lib/overcommit/hook/pre_push/protected_branches.rb
|
220
221
|
- lib/overcommit/hook/pre_push/pytest.rb
|
221
222
|
- lib/overcommit/hook/pre_push/python_nose.rb
|
@@ -231,6 +232,7 @@ files:
|
|
231
232
|
- lib/overcommit/hook/shared/composer_install.rb
|
232
233
|
- lib/overcommit/hook/shared/index_tags.rb
|
233
234
|
- lib/overcommit/hook/shared/npm_install.rb
|
235
|
+
- lib/overcommit/hook/shared/pronto.rb
|
234
236
|
- lib/overcommit/hook/shared/rake_target.rb
|
235
237
|
- lib/overcommit/hook/shared/submodule_status.rb
|
236
238
|
- lib/overcommit/hook/shared/yarn_install.rb
|
@@ -294,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
294
296
|
- !ruby/object:Gem::Version
|
295
297
|
version: '0'
|
296
298
|
requirements: []
|
297
|
-
rubygems_version: 3.
|
299
|
+
rubygems_version: 3.1.1
|
298
300
|
signing_key:
|
299
301
|
specification_version: 4
|
300
302
|
summary: Git hook manager
|