overcommit 0.52.1 → 0.53.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +7 -0
- data/lib/overcommit/hook/base.rb +2 -1
- 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/printer.rb +1 -0
- data/lib/overcommit/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f21bd45048df18d59d884ff63d79c3d3304116125497e788e1127b53c449c52
|
4
|
+
data.tar.gz: 5e7c92a6e7c241b4f3f0498fe42347fde0863317f4e7097adb89e6ebd44fb0b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c7182368533a88cbccabcf3dfdee1df57bbdc37b5a865a4f3bc37d30eb128d5af5ac655932141a68687a3fb56500dbe443e56f26b82fa43d10e12cc0ee8cf44
|
7
|
+
data.tar.gz: 8ef215e68656618666eebe1a48369a924731e909674a27cc42172427ace29104ba67d0cdaafa72c22b8693deb9baaf81d41c6355653111d5775d6a81f5f1260b
|
data/config/default.yml
CHANGED
@@ -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'
|
data/lib/overcommit/hook/base.rb
CHANGED
@@ -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.53.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: 2020-
|
11
|
+
date: 2020-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: childprocess
|
@@ -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
|