overcommit 0.44.0 → 0.45.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 757f60633c3904f1c63681afc14f3a3e7874f05ad3bef92af6c9d9351ea45d29
4
- data.tar.gz: fb3126490d063d44c9c1e27fdd67a84de2bcb87359b3db619e50f6f2f634ab6d
3
+ metadata.gz: 0f1f3224b8c51c6c50b52e986004d11874970a11b9c47780a6ae4c01b9df6ea6
4
+ data.tar.gz: 4fe8b023481b5e401232a89291a2a6b91223132d15be927568f30770ff9b5d1d
5
5
  SHA512:
6
- metadata.gz: 839e44ead515bfb13c13fab2e0e4b0859a1fb691d67c7ddb958bdbb3533b4945731cda5bb81b5c90d2e345ff08e069760d4dcfb4c099cd5798a380f24cef126d
7
- data.tar.gz: ffc50fa2e8b3aa5c8be0ae8e73745062f465c4379bb07fbd4f8166378a2237bb0c32a9ab3c7f2e66f6cdec02ae4ce6fa275f858ec31edf4c13f0ded6e15fb956
6
+ metadata.gz: 8b0824349ab9379be8b2ecd1d924ada6f920544a96b6bc84a257e349595c0df65c7e8900883a9928a2e8ca375f3a12efc181e2d5cad7612fdc86c5a44fbd9623
7
+ data.tar.gz: cfca38d75fee7228b335c2da2a33e34859d726e40dd8423bfaa60f464c79a0aabf7673cd991ab900cd0ed9c1159f76976aac5a24dfb01675348e38871190c9f8
@@ -108,6 +108,7 @@ CommitMsg:
108
108
  enabled: true
109
109
  description: 'Check text width'
110
110
  max_subject_width: 60
111
+ min_subject_width: 0
111
112
  max_body_width: 72
112
113
 
113
114
  TrailingPeriod:
@@ -1117,6 +1118,13 @@ PrePush:
1117
1118
  flags: ['--exit-on-warn', '--quiet', '--summary']
1118
1119
  install_command: 'gem install brakeman'
1119
1120
 
1121
+ CargoTest:
1122
+ enabled: false
1123
+ description: 'Run tests with cargo'
1124
+ required_executable: 'cargo'
1125
+ flags: ['test']
1126
+ include: 'src/**/*.rs'
1127
+
1120
1128
  GitLfs:
1121
1129
  enabled: false
1122
1130
  description: 'Upload files tracked by Git LFS'
@@ -12,7 +12,7 @@ module Overcommit
12
12
  #
13
13
  # @return [Overcommit::Configuration]
14
14
  def default_configuration
15
- @default_config ||= load_from_file(DEFAULT_CONFIG_PATH, default: true, verify: false)
15
+ @default_configuration ||= load_from_file(DEFAULT_CONFIG_PATH, default: true, verify: false)
16
16
  end
17
17
 
18
18
  # Loads configuration from file.
@@ -21,9 +21,17 @@ module Overcommit::Hook::CommitMsg
21
21
  max_subject_width =
22
22
  config['max_subject_width'] +
23
23
  special_prefix_length(subject)
24
- return unless subject.length > max_subject_width
25
24
 
26
- @errors << "Please keep the subject <= #{max_subject_width} characters"
25
+ if subject.length > max_subject_width
26
+ @errors << "Commit message subject must be <= #{max_subject_width} characters"
27
+ return
28
+ end
29
+
30
+ min_subject_width = config['min_subject_width']
31
+ if subject.length < min_subject_width
32
+ @errors << "Commit message subject must be >= #{min_subject_width} characters"
33
+ return
34
+ end
27
35
  end
28
36
 
29
37
  def find_errors_in_body(lines)
@@ -37,7 +37,7 @@ module Overcommit::Hook::PreCommit
37
37
  end
38
38
 
39
39
  def license_lines
40
- @license_regex ||= begin
40
+ @license_lines ||= begin
41
41
  file_root = Overcommit::Utils.convert_glob_to_absolute(license_file)
42
42
  File.read(file_root).split("\n")
43
43
  end
@@ -46,6 +46,7 @@ module Overcommit::Hook::PreCommit
46
46
 
47
47
  def schema
48
48
  @schema ||= schema_files.map { |file| File.read(file) }.join
49
+ @schema.tr('_', '')
49
50
  end
50
51
 
51
52
  def non_zero_schema_version?
@@ -0,0 +1,10 @@
1
+ module Overcommit::Hook::PrePush
2
+ # Runs `cargo test` before push if Rust files changed
3
+ class CargoTest < Base
4
+ def run
5
+ result = execute(command)
6
+ return :pass if result.success?
7
+ [:fail, result.stdout]
8
+ end
9
+ end
10
+ end
@@ -27,7 +27,7 @@ module Overcommit
27
27
  private
28
28
 
29
29
  def host_os
30
- @os ||= ::RbConfig::CONFIG['host_os'].freeze
30
+ @host_os ||= ::RbConfig::CONFIG['host_os'].freeze
31
31
  end
32
32
  end
33
33
 
@@ -59,7 +59,9 @@ module Overcommit
59
59
  def git_dir
60
60
  @git_dir ||=
61
61
  begin
62
- result = execute(%w[git rev-parse --git-common-dir])
62
+ cmd = %w[git rev-parse]
63
+ cmd << (GIT_VERSION < '2.5' ? '--git-dir' : '--git-common-dir')
64
+ result = execute(cmd)
63
65
  unless result.success?
64
66
  raise Overcommit::Exceptions::InvalidGitRepo,
65
67
  'Unable to determine location of GIT_DIR. ' \
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module Overcommit
5
- VERSION = '0.44.0'.freeze
5
+ VERSION = '0.45.0'.freeze
6
6
  end
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.44.0
4
+ version: 0.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brigade Engineering
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-11 00:00:00.000000000 Z
12
+ date: 2018-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: childprocess
@@ -199,6 +199,7 @@ files:
199
199
  - lib/overcommit/hook/pre_commit/yarn_check.rb
200
200
  - lib/overcommit/hook/pre_push/base.rb
201
201
  - lib/overcommit/hook/pre_push/brakeman.rb
202
+ - lib/overcommit/hook/pre_push/cargo_test.rb
202
203
  - lib/overcommit/hook/pre_push/minitest.rb
203
204
  - lib/overcommit/hook/pre_push/php_unit.rb
204
205
  - lib/overcommit/hook/pre_push/protected_branches.rb
@@ -268,7 +269,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
268
269
  requirements:
269
270
  - - ">="
270
271
  - !ruby/object:Gem::Version
271
- version: '2.1'
272
+ version: '2.2'
272
273
  required_rubygems_version: !ruby/object:Gem::Requirement
273
274
  requirements:
274
275
  - - ">="