overcommit 0.47.0 → 0.48.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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/config/default.yml +5 -0
  3. data/config/starter.yml +3 -3
  4. data/lib/overcommit/configuration_validator.rb +1 -1
  5. data/lib/overcommit/constants.rb +3 -3
  6. data/lib/overcommit/hook/base.rb +2 -5
  7. data/lib/overcommit/hook/commit_msg/message_format.rb +1 -1
  8. data/lib/overcommit/hook/post_checkout/bower_install.rb +1 -1
  9. data/lib/overcommit/hook/post_checkout/bundle_install.rb +1 -1
  10. data/lib/overcommit/hook/post_checkout/composer_install.rb +1 -1
  11. data/lib/overcommit/hook/post_checkout/index_tags.rb +1 -1
  12. data/lib/overcommit/hook/post_checkout/npm_install.rb +1 -1
  13. data/lib/overcommit/hook/post_checkout/yarn_install.rb +1 -1
  14. data/lib/overcommit/hook/post_commit/bower_install.rb +1 -1
  15. data/lib/overcommit/hook/post_commit/bundle_install.rb +1 -1
  16. data/lib/overcommit/hook/post_commit/composer_install.rb +1 -1
  17. data/lib/overcommit/hook/post_commit/index_tags.rb +1 -1
  18. data/lib/overcommit/hook/post_commit/npm_install.rb +1 -1
  19. data/lib/overcommit/hook/post_commit/yarn_install.rb +1 -1
  20. data/lib/overcommit/hook/post_merge/bower_install.rb +1 -1
  21. data/lib/overcommit/hook/post_merge/bundle_install.rb +1 -1
  22. data/lib/overcommit/hook/post_merge/composer_install.rb +1 -1
  23. data/lib/overcommit/hook/post_merge/index_tags.rb +1 -1
  24. data/lib/overcommit/hook/post_merge/npm_install.rb +1 -1
  25. data/lib/overcommit/hook/post_merge/yarn_install.rb +1 -1
  26. data/lib/overcommit/hook/post_rewrite/bower_install.rb +1 -1
  27. data/lib/overcommit/hook/post_rewrite/bundle_install.rb +1 -1
  28. data/lib/overcommit/hook/post_rewrite/composer_install.rb +1 -1
  29. data/lib/overcommit/hook/post_rewrite/index_tags.rb +1 -1
  30. data/lib/overcommit/hook/post_rewrite/npm_install.rb +1 -1
  31. data/lib/overcommit/hook/post_rewrite/yarn_install.rb +1 -1
  32. data/lib/overcommit/hook/pre_commit/author_email.rb +1 -1
  33. data/lib/overcommit/hook/pre_commit/berksfile_check.rb +1 -1
  34. data/lib/overcommit/hook/pre_commit/bundle_audit.rb +1 -1
  35. data/lib/overcommit/hook/pre_commit/bundle_check.rb +1 -1
  36. data/lib/overcommit/hook/pre_commit/bundle_outdated.rb +1 -1
  37. data/lib/overcommit/hook/pre_commit/cook_style.rb +1 -1
  38. data/lib/overcommit/hook/pre_commit/file_size.rb +47 -0
  39. data/lib/overcommit/hook/pre_commit/go_vet.rb +1 -1
  40. data/lib/overcommit/hook/pre_commit/jsl.rb +1 -1
  41. data/lib/overcommit/hook/pre_commit/rake_target.rb +1 -1
  42. data/lib/overcommit/hook/pre_commit/rubo_cop.rb +1 -1
  43. data/lib/overcommit/hook/pre_commit/scss_lint.rb +1 -1
  44. data/lib/overcommit/hook/pre_commit/yarn_check.rb +1 -1
  45. data/lib/overcommit/hook/pre_push/rake_target.rb +1 -1
  46. data/lib/overcommit/hook/prepare_commit_msg/replace_branch.rb +1 -1
  47. data/lib/overcommit/hook/shared/rake_target.rb +1 -1
  48. data/lib/overcommit/hook_context/prepare_commit_msg.rb +1 -1
  49. data/lib/overcommit/message_processor.rb +6 -6
  50. data/lib/overcommit/utils.rb +1 -1
  51. data/lib/overcommit/version.rb +1 -1
  52. metadata +6 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cbfe83620ba468c0053d8303aa80350c50db1fe8a3d90028d0ae2794c219834
4
- data.tar.gz: 9f3f6b7d8675cb83e65dc554d9ebe76de0f3287acfcb7f2161c3880ad315ceb9
3
+ metadata.gz: 9daaca7072540df4bd522b92ad834538848ed7e7baa2cda6a545574ba1aeb494
4
+ data.tar.gz: 0a47820c56e90b7598eb09e6d51d9a64e3fc6b8b56e6c4cb4dcd9b6afd7711d8
5
5
  SHA512:
6
- metadata.gz: a683f507f19caa0ab810b8b7635ddf4672d5daa3b2519090278bbc23da8e7662a3e1d95743dd61f2f12c1f308b1678fec6461c3d54bde8acfa4c89d2d03fc39b
7
- data.tar.gz: 0b03b050b2e46d24e8d524de3d0b1b11c895173161d55f9e63224710191419a57f7d7bf8b8ae6e14f6d53f601ac2cecb85dd430e25105588e87b26b244047bc7
6
+ metadata.gz: 0c5b567931123d658f76566c5154ab574923b9b6a3c7530c83d1c36fc05b0e42021f58837e0f1edd59b00ec00382c43b3ec5cccbafb5001fa8aeb8fb591b7210
7
+ data.tar.gz: d09e08f4ca81501c4d530600896c04981c12c55353753e692b4e64126a7de4ee79084864ead0ab4c670cb47c3d868e26976a402795ee111e4ac983baa598d888
@@ -293,6 +293,11 @@ PreCommit:
293
293
  flags: ['-IEHnw']
294
294
  keywords: ['BROKEN', 'BUG', 'ERROR', 'FIXME', 'HACK', 'NOTE', 'OPTIMIZE', 'REVIEW', 'TODO', 'WTF', 'XXX']
295
295
 
296
+ FileSize:
297
+ enabled: false
298
+ description: 'Check for oversized files'
299
+ size_limit_bytes: 1_000_000
300
+
296
301
  Flay:
297
302
  enabled: false
298
303
  description: 'Analyze ruby code for structural similarities with Flay'
@@ -1,6 +1,6 @@
1
1
  # Use this file to configure the Overcommit hooks you wish to use. This will
2
2
  # extend the default configuration defined in:
3
- # https://github.com/brigade/overcommit/blob/master/config/default.yml
3
+ # https://github.com/sds/overcommit/blob/master/config/default.yml
4
4
  #
5
5
  # At the topmost level of this YAML file is a key representing type of hook
6
6
  # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
@@ -8,10 +8,10 @@
8
8
  # `include`), whether to only display output if it fails (via `quiet`), etc.
9
9
  #
10
10
  # For a complete list of hooks, see:
11
- # https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
11
+ # https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
12
12
  #
13
13
  # For a complete list of options that you can use to customize hooks, see:
14
- # https://github.com/brigade/overcommit#configuration
14
+ # https://github.com/sds/overcommit#configuration
15
15
  #
16
16
  # Uncomment the following lines to make the configuration take effect.
17
17
 
@@ -102,7 +102,7 @@ module Overcommit
102
102
  hash.fetch(hook_type) { {} }.each_key do |hook_name|
103
103
  next if hook_name == 'ALL'
104
104
 
105
- unless hook_name =~ /\A[A-Za-z0-9]+\z/
105
+ unless hook_name.match?(/\A[A-Za-z0-9]+\z/)
106
106
  errors << "#{hook_type}::#{hook_name} has an invalid name " \
107
107
  "#{hook_name}. It must contain only alphanumeric " \
108
108
  'characters (no underscores or dashes, etc.)'
@@ -3,10 +3,10 @@
3
3
  # Global application constants.
4
4
  module Overcommit
5
5
  HOME = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
6
- CONFIG_FILE_NAME = '.overcommit.yml'.freeze
6
+ CONFIG_FILE_NAME = '.overcommit.yml'
7
7
 
8
8
  HOOK_DIRECTORY = File.join(HOME, 'lib', 'overcommit', 'hook').freeze
9
9
 
10
- REPO_URL = 'https://github.com/brigade/overcommit'.freeze
11
- BUG_REPORT_URL = "#{REPO_URL}/issues".freeze
10
+ REPO_URL = 'https://github.com/sds/overcommit'
11
+ BUG_REPORT_URL = "#{REPO_URL}/issues"
12
12
  end
@@ -204,11 +204,8 @@ module Overcommit::Hook
204
204
  def check_for_executable
205
205
  return unless required_executable && !in_path?(required_executable)
206
206
 
207
- output = "'#{required_executable}' is not installed, not in your PATH, " \
208
- 'or does not have execute permissions'
209
- output << install_command_prompt
210
-
211
- output
207
+ "'#{required_executable}' is not installed, not in your PATH, " \
208
+ "or does not have execute permissions#{install_command_prompt}"
212
209
  end
213
210
 
214
211
  def install_command_prompt
@@ -19,7 +19,7 @@ module Overcommit::Hook::CommitMsg
19
19
  expected_pattern_message = config['expected_pattern_message']
20
20
  sample_message = config['sample_message']
21
21
 
22
- unless message =~ /#{pattern}/
22
+ unless message.match?(/#{pattern}/m)
23
23
  [
24
24
  'Commit message pattern mismatch.',
25
25
  "Expected : #{expected_pattern_message}",
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCheckout
6
6
  # Runs `bower install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::BowerInstall}
9
+ # @see Overcommit::Hook::Shared::BowerInstall
10
10
  class BowerInstall < Base
11
11
  include Overcommit::Hook::Shared::BowerInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCheckout
6
6
  # Runs `bundle install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::BundleInstall}
9
+ # @see Overcommit::Hook::Shared::BundleInstall
10
10
  class BundleInstall < Base
11
11
  include Overcommit::Hook::Shared::BundleInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCheckout
6
6
  # Runs `composer install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::ComposerInstall}
9
+ # @see Overcommit::Hook::Shared::ComposerInstall
10
10
  class ComposerInstall < Base
11
11
  include Overcommit::Hook::Shared::ComposerInstall
12
12
  end
@@ -5,7 +5,7 @@ require 'overcommit/hook/shared/index_tags'
5
5
  module Overcommit::Hook::PostCheckout
6
6
  # Updates ctags index for all source code in the repository.
7
7
  #
8
- # @see {Overcommit::Hook::Shared::IndexTags}
8
+ # @see Overcommit::Hook::Shared::IndexTags
9
9
  class IndexTags < Base
10
10
  include Overcommit::Hook::Shared::IndexTags
11
11
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCheckout
6
6
  # Runs `npm install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::NpmInstall}
9
+ # @see Overcommit::Hook::Shared::NpmInstall
10
10
  class NpmInstall < Base
11
11
  include Overcommit::Hook::Shared::NpmInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCheckout
6
6
  # Runs `yarn install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::YarnInstall}
9
+ # @see Overcommit::Hook::Shared::YarnInstall
10
10
  class YarnInstall < Base
11
11
  include Overcommit::Hook::Shared::YarnInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCommit
6
6
  # Runs `bower install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::BowerInstall}
9
+ # @see Overcommit::Hook::Shared::BowerInstall
10
10
  class BowerInstall < Base
11
11
  include Overcommit::Hook::Shared::BowerInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCommit
6
6
  # Runs `bundle install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::BundleInstall}
9
+ # @see Overcommit::Hook::Shared::BundleInstall
10
10
  class BundleInstall < Base
11
11
  include Overcommit::Hook::Shared::BundleInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCommit
6
6
  # Runs `composer install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::ComposerInstall}
9
+ # @see Overcommit::Hook::Shared::ComposerInstall
10
10
  class ComposerInstall < Base
11
11
  include Overcommit::Hook::Shared::ComposerInstall
12
12
  end
@@ -5,7 +5,7 @@ require 'overcommit/hook/shared/index_tags'
5
5
  module Overcommit::Hook::PostCommit
6
6
  # Updates ctags index for all source code in the repository.
7
7
  #
8
- # @see {Overcommit::Hook::Shared::IndexTags}
8
+ # @see Overcommit::Hook::Shared::IndexTags
9
9
  class IndexTags < Base
10
10
  include Overcommit::Hook::Shared::IndexTags
11
11
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCommit
6
6
  # Runs `npm install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::NpmInstall}
9
+ # @see Overcommit::Hook::Shared::NpmInstall
10
10
  class NpmInstall < Base
11
11
  include Overcommit::Hook::Shared::NpmInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostCommit
6
6
  # Runs `yarn install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::YarnInstall}
9
+ # @see Overcommit::Hook::Shared::YarnInstall
10
10
  class YarnInstall < Base
11
11
  include Overcommit::Hook::Shared::YarnInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostMerge
6
6
  # Runs `bower install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::BowerInstall}
9
+ # @see Overcommit::Hook::Shared::BowerInstall
10
10
  class BowerInstall < Base
11
11
  include Overcommit::Hook::Shared::BowerInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostMerge
6
6
  # Runs `bundle install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::BundleInstall}
9
+ # @see Overcommit::Hook::Shared::BundleInstall
10
10
  class BundleInstall < Base
11
11
  include Overcommit::Hook::Shared::BundleInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostMerge
6
6
  # Runs `composer install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::ComposerInstall}
9
+ # @see Overcommit::Hook::Shared::ComposerInstall
10
10
  class ComposerInstall < Base
11
11
  include Overcommit::Hook::Shared::ComposerInstall
12
12
  end
@@ -5,7 +5,7 @@ require 'overcommit/hook/shared/index_tags'
5
5
  module Overcommit::Hook::PostMerge
6
6
  # Updates ctags index for all source code in the repository.
7
7
  #
8
- # @see {Overcommit::Hook::Shared::IndexTags}
8
+ # @see Overcommit::Hook::Shared::IndexTags
9
9
  class IndexTags < Base
10
10
  include Overcommit::Hook::Shared::IndexTags
11
11
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostMerge
6
6
  # Runs `npm install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::NpmInstall}
9
+ # @see Overcommit::Hook::Shared::NpmInstall
10
10
  class NpmInstall < Base
11
11
  include Overcommit::Hook::Shared::NpmInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostMerge
6
6
  # Runs `yarn install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::YarnInstall}
9
+ # @see Overcommit::Hook::Shared::YarnInstall
10
10
  class YarnInstall < Base
11
11
  include Overcommit::Hook::Shared::YarnInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostRewrite
6
6
  # Runs `bower install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::BowerInstall}
9
+ # @see Overcommit::Hook::Shared::BowerInstall
10
10
  class BowerInstall < Base
11
11
  include Overcommit::Hook::Shared::BowerInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostRewrite
6
6
  # Runs `bundle install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::BundleInstall}
9
+ # @see Overcommit::Hook::Shared::BundleInstall
10
10
  class BundleInstall < Base
11
11
  include Overcommit::Hook::Shared::BundleInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostRewrite
6
6
  # Runs `composer install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::ComposerInstall}
9
+ # @see Overcommit::Hook::Shared::ComposerInstall
10
10
  class ComposerInstall < Base
11
11
  include Overcommit::Hook::Shared::ComposerInstall
12
12
  end
@@ -5,7 +5,7 @@ require 'overcommit/hook/shared/index_tags'
5
5
  module Overcommit::Hook::PostRewrite
6
6
  # Updates ctags index for all source code in the repository.
7
7
  #
8
- # @see {Overcommit::Hook::Shared::IndexTags}
8
+ # @see Overcommit::Hook::Shared::IndexTags
9
9
  class IndexTags < Base
10
10
  include Overcommit::Hook::Shared::IndexTags
11
11
 
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostRewrite
6
6
  # Runs `npm install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::NpmInstall}
9
+ # @see Overcommit::Hook::Shared::NpmInstall
10
10
  class NpmInstall < Base
11
11
  include Overcommit::Hook::Shared::NpmInstall
12
12
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PostRewrite
6
6
  # Runs `yarn install` when a change is detected in the repository's
7
7
  # dependencies.
8
8
  #
9
- # @see {Overcommit::Hook::Shared::YarnInstall}
9
+ # @see Overcommit::Hook::Shared::YarnInstall
10
10
  class YarnInstall < Base
11
11
  include Overcommit::Hook::Shared::YarnInstall
12
12
  end
@@ -12,7 +12,7 @@ module Overcommit::Hook::PreCommit
12
12
  result.stdout.chomp
13
13
  end
14
14
 
15
- unless email =~ /#{config['pattern']}/
15
+ unless email.match?(/#{config['pattern']}/)
16
16
  return :fail,
17
17
  "Author has an invalid email address: '#{email}'\n" \
18
18
  'Set your email with ' \
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
6
6
  #
7
7
  # @see http://berkshelf.com/
8
8
  class BerksfileCheck < Base
9
- LOCK_FILE = 'Berksfile.lock'.freeze
9
+ LOCK_FILE = 'Berksfile.lock'
10
10
 
11
11
  def run
12
12
  # Ignore if Berksfile.lock is not tracked by git
@@ -5,7 +5,7 @@ module Overcommit::Hook::PreCommit
5
5
  #
6
6
  # @see https://github.com/rubysec/bundler-audit
7
7
  class BundleAudit < Base
8
- LOCK_FILE = 'Gemfile.lock'.freeze
8
+ LOCK_FILE = 'Gemfile.lock'
9
9
 
10
10
  def run
11
11
  # Ignore if Gemfile.lock is not tracked by git
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
6
6
  #
7
7
  # @see http://bundler.io/
8
8
  class BundleCheck < Base
9
- LOCK_FILE = 'Gemfile.lock'.freeze
9
+ LOCK_FILE = 'Gemfile.lock'
10
10
 
11
11
  def run
12
12
  # Ignore if Gemfile.lock is not tracked by git
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
6
6
  #
7
7
  # @see http://bundler.io/bundle_outdated.html
8
8
  class BundleOutdated < Base
9
- LOCK_FILE = 'Gemfile.lock'.freeze
9
+ LOCK_FILE = 'Gemfile.lock'
10
10
 
11
11
  def run
12
12
  # Ignore if Gemfile.lock is not tracked by git
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
6
6
  # @see https://docs.chef.io/cookstyle.html
7
7
  class CookStyle < Base
8
8
  GENERIC_MESSAGE_TYPE_CATEGORIZER = lambda do |type|
9
- type =~ /^warn/ ? :warning : :error
9
+ type.match?(/^warn/) ? :warning : :error
10
10
  end
11
11
 
12
12
  COP_MESSAGE_TYPE_CATEGORIZER = lambda do |type|
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Overcommit::Hook::PreCommit
4
+ # Checks for oversized files before committing.
5
+ class FileSize < Base
6
+ def run
7
+ return :pass if oversized_files.empty?
8
+
9
+ oversized_files.map do |file|
10
+ error_message_for(file)
11
+ end
12
+ end
13
+
14
+ def description
15
+ "Check for files over #{size_limit_bytes} bytes"
16
+ end
17
+
18
+ private
19
+
20
+ def oversized_files
21
+ @oversized_files ||= build_oversized_file_list
22
+ end
23
+
24
+ def build_oversized_file_list
25
+ applicable_files.select do |file|
26
+ File.exist?(file) && file_size(file) > size_limit_bytes
27
+ end
28
+ end
29
+
30
+ def size_limit_bytes
31
+ config.fetch('size_limit_bytes')
32
+ end
33
+
34
+ def error_message_for(file)
35
+ Overcommit::Hook::Message.new(
36
+ :error,
37
+ file,
38
+ nil,
39
+ "#{file} is #{file_size(file)} bytes"
40
+ )
41
+ end
42
+
43
+ def file_size(file)
44
+ File.size(file)
45
+ end
46
+ end
47
+ end
@@ -9,7 +9,7 @@ module Overcommit::Hook::PreCommit
9
9
  result = execute(command, args: applicable_files)
10
10
  return :pass if result.success?
11
11
 
12
- if result.stderr =~ /no such tool "vet"/
12
+ if result.stderr.match?(/no such tool "vet"/)
13
13
  return :fail, "`go tool vet` is not installed#{install_command_prompt}"
14
14
  end
15
15
 
@@ -8,7 +8,7 @@ module Overcommit::Hook::PreCommit
8
8
  MESSAGE_REGEX = /(?<file>(?:\w:)?.+)\((?<line>\d+)\):(?<type>[^:]+)/
9
9
 
10
10
  MESSAGE_TYPE_CATEGORIZER = lambda do |type|
11
- type =~ /warning/ ? :warning : :error
11
+ type.match?(/warning/) ? :warning : :error
12
12
  end
13
13
 
14
14
  def run
@@ -5,7 +5,7 @@ require 'overcommit/hook/shared/rake_target'
5
5
  module Overcommit::Hook::PreCommit
6
6
  # Runs rake targets
7
7
  #
8
- # @see {Overcommit::Hook::Shared::RakeTarget}
8
+ # @see Overcommit::Hook::Shared::RakeTarget
9
9
  class RakeTarget < Base
10
10
  include Overcommit::Hook::Shared::RakeTarget
11
11
  end
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
6
6
  # @see http://batsov.com/rubocop/
7
7
  class RuboCop < Base
8
8
  GENERIC_MESSAGE_TYPE_CATEGORIZER = lambda do |type|
9
- type =~ /^warn/ ? :warning : :error
9
+ type.match?(/^warn/) ? :warning : :error
10
10
  end
11
11
 
12
12
  COP_MESSAGE_TYPE_CATEGORIZER = lambda do |type|
@@ -3,7 +3,7 @@
3
3
  module Overcommit::Hook::PreCommit
4
4
  # Runs `scss-lint` against any modified SCSS files.
5
5
  #
6
- # @see https://github.com/brigade/scss-lint
6
+ # @see https://github.com/sds/scss-lint
7
7
  class ScssLint < Base
8
8
  def run
9
9
  result = execute(command, args: applicable_files)
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
6
6
  #
7
7
  # @see https://yarnpkg.com/en/docs/cli/check
8
8
  class YarnCheck < Base
9
- LOCK_FILE = 'yarn.lock'.freeze
9
+ LOCK_FILE = 'yarn.lock'
10
10
 
11
11
  # A lot of the errors returned by `yarn check` are outside the developer's control
12
12
  # (are caused by bad package specification, in the hands of the upstream maintainer)
@@ -5,7 +5,7 @@ require 'overcommit/hook/shared/rake_target'
5
5
  module Overcommit::Hook::PrePush
6
6
  # Runs rake targets
7
7
  #
8
- # @see {Overcommit::Hook::Shared::RakeTarget}
8
+ # @see Overcommit::Hook::Shared::RakeTarget
9
9
  class RakeTarget < Base
10
10
  include Overcommit::Hook::Shared::RakeTarget
11
11
  end
@@ -11,7 +11,7 @@ module Overcommit::Hook::PrepareCommitMsg
11
11
  Overcommit::Utils.log.debug(
12
12
  "Checking if '#{Overcommit::GitRepo.current_branch}' matches #{branch_pattern}"
13
13
  )
14
- if branch_pattern.match(Overcommit::GitRepo.current_branch)
14
+ if branch_pattern.match?(Overcommit::GitRepo.current_branch)
15
15
  Overcommit::Utils.log.debug("Writing #{commit_message_filename} with #{new_template}")
16
16
  modify_commit_message do |old_contents|
17
17
  "#{new_template}\n#{old_contents}"
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Overcommit::Hook::Shared
4
4
  # runs specified rake targets. It fails on the first non-
5
- # successfull exit.
5
+ # successful exit.
6
6
  #
7
7
  module RakeTarget
8
8
  def run
@@ -16,7 +16,7 @@ module Overcommit::HookContext
16
16
  # exists); or commit, followed by a commit SHA-1 (if a -c, -C or --amend
17
17
  # option was given)
18
18
  def commit_message_source
19
- @args[1].to_sym if @args[1]
19
+ @args[1]&.to_sym
20
20
  end
21
21
 
22
22
  # Returns the commit's SHA-1.
@@ -8,12 +8,12 @@ module Overcommit
8
8
  # output tuple from an array of {Overcommit::Hook::Message}s, respecting the
9
9
  # configuration settings for the given hook.
10
10
  class MessageProcessor
11
- ERRORS_MODIFIED_HEADER = 'Errors on modified lines:'.freeze
12
- WARNINGS_MODIFIED_HEADER = 'Warnings on modified lines:'.freeze
13
- ERRORS_UNMODIFIED_HEADER = "Errors on lines you didn't modify:".freeze
14
- WARNINGS_UNMODIFIED_HEADER = "Warnings on lines you didn't modify:".freeze
15
- ERRORS_GENERIC_HEADER = 'Errors:'.freeze
16
- WARNINGS_GENERIC_HEADER = 'Warnings:'.freeze
11
+ ERRORS_MODIFIED_HEADER = 'Errors on modified lines:'
12
+ WARNINGS_MODIFIED_HEADER = 'Warnings on modified lines:'
13
+ ERRORS_UNMODIFIED_HEADER = "Errors on lines you didn't modify:"
14
+ WARNINGS_UNMODIFIED_HEADER = "Warnings on lines you didn't modify:"
15
+ ERRORS_GENERIC_HEADER = 'Errors:'
16
+ WARNINGS_GENERIC_HEADER = 'Warnings:'
17
17
 
18
18
  # @param hook [Overcommit::Hook::Base]
19
19
  # @param unmodified_lines_setting [String] how to treat messages on
@@ -297,7 +297,7 @@ module Overcommit
297
297
  #
298
298
  # @param args [Array<String>]
299
299
  def debug(*args)
300
- log.debug(*args) if log
300
+ log&.debug(*args)
301
301
  end
302
302
  end
303
303
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module Overcommit
5
- VERSION = '0.47.0'.freeze
5
+ VERSION = '0.48.0'
6
6
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: overcommit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.0
4
+ version: 0.48.0
5
5
  platform: ruby
6
6
  authors:
7
- - Brigade Engineering
8
7
  - Shane da Silva
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2019-03-23 00:00:00.000000000 Z
11
+ date: 2019-05-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: childprocess
@@ -47,8 +46,7 @@ dependencies:
47
46
  version: '1.4'
48
47
  description: Utility to install, configure, and extend Git hooks
49
48
  email:
50
- - eng@brigade.com
51
- - shane.dasilva@brigade.com
49
+ - shane@dasilva.io
52
50
  executables:
53
51
  - overcommit
54
52
  extensions: []
@@ -134,6 +132,7 @@ files:
134
132
  - lib/overcommit/hook/pre_commit/es_lint.rb
135
133
  - lib/overcommit/hook/pre_commit/execute_permissions.rb
136
134
  - lib/overcommit/hook/pre_commit/fasterer.rb
135
+ - lib/overcommit/hook/pre_commit/file_size.rb
137
136
  - lib/overcommit/hook/pre_commit/fix_me.rb
138
137
  - lib/overcommit/hook/pre_commit/flay.rb
139
138
  - lib/overcommit/hook/pre_commit/foodcritic.rb
@@ -268,7 +267,7 @@ files:
268
267
  - template-dir/hooks/pre-push
269
268
  - template-dir/hooks/pre-rebase
270
269
  - template-dir/hooks/prepare-commit-msg
271
- homepage: https://github.com/brigade/overcommit
270
+ homepage: https://github.com/sds/overcommit
272
271
  licenses:
273
272
  - MIT
274
273
  metadata: {}
@@ -281,7 +280,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
281
280
  requirements:
282
281
  - - ">="
283
282
  - !ruby/object:Gem::Version
284
- version: '2.2'
283
+ version: '2.4'
285
284
  required_rubygems_version: !ruby/object:Gem::Requirement
286
285
  requirements:
287
286
  - - ">="