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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d754f1b3cae9fb7a74e38645a47a52e84337692b53ac32be7079296ef6f0c4ef
4
- data.tar.gz: 1065cb959d9285aca1541fc5ed6523e7c237dfc5f0fb6acbd129c1edc4c772c4
3
+ metadata.gz: 7f21bd45048df18d59d884ff63d79c3d3304116125497e788e1127b53c449c52
4
+ data.tar.gz: 5e7c92a6e7c241b4f3f0498fe42347fde0863317f4e7097adb89e6ebd44fb0b4
5
5
  SHA512:
6
- metadata.gz: dee7031b48c46a3b42f27701dd922d63468340498f3745d11a1c5bbe2a573e408a2d1fe266b96313d319dc3e43eb8401d4624cf4e94d835df850b25efea859dd
7
- data.tar.gz: 69389da703ab37e63f35d7267b70a6a1a8fb3c7afd80cdadbe6f2ff32fe27428c45276b34b2286dd01930e0a9c78f5d2bc44f707c5980f501460897a79aebcf3
6
+ metadata.gz: 3c7182368533a88cbccabcf3dfdee1df57bbdc37b5a865a4f3bc37d30eb128d5af5ac655932141a68687a3fb56500dbe443e56f26b82fa43d10e12cc0ee8cf44
7
+ data.tar.gz: 8ef215e68656618666eebe1a48369a924731e909674a27cc42172427ace29104ba67d0cdaafa72c22b8693deb9baaf81d41c6355653111d5775d6a81f5f1260b
@@ -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'
@@ -84,7 +84,8 @@ module Overcommit::Hook
84
84
  end
85
85
 
86
86
  def skip?
87
- @config['skip']
87
+ @config['skip'] ||
88
+ (@config['skip_if'] ? execute(@config['skip_if']).success? : false)
88
89
  end
89
90
 
90
91
  def run?
@@ -12,21 +12,14 @@ module Overcommit::Hook::PreCommit
12
12
  def run
13
13
  messages = []
14
14
 
15
- applicable_files.each do |file|
16
- result = execute(command, args: [file])
17
- if result.status
18
- rows = result.stdout.split("\n")
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
- MESSAGE_TYPE_CATEGORIZER = lambda do |type|
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
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'overcommit/hook/shared/pronto'
4
+
5
+ module Overcommit::Hook::PrePush
6
+ # Runs `pronto`
7
+ #
8
+ # @see https://github.com/mmozuras/pronto
9
+ class Pronto < Base
10
+ include Overcommit::Hook::Shared::Pronto
11
+ end
12
+ 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}\n#{old_contents}"
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
@@ -51,6 +51,7 @@ module Overcommit
51
51
  def run_interrupted
52
52
  log.newline
53
53
  log.warning '⚠ Hook run interrupted by user'
54
+ log.warning '⚠ If files appear modified/missing, check your stash to recover them'
54
55
  log.newline
55
56
  end
56
57
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module Overcommit
5
- VERSION = '0.52.1'
5
+ VERSION = '0.53.0'
6
6
  end
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.52.1
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-01-04 00:00:00.000000000 Z
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