overcommit 0.57.0 → 0.59.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/bin/overcommit +6 -5
  3. data/config/default.yml +20 -0
  4. data/lib/overcommit/cli.rb +14 -13
  5. data/lib/overcommit/command_splitter.rb +2 -0
  6. data/lib/overcommit/configuration.rb +1 -1
  7. data/lib/overcommit/configuration_loader.rb +11 -8
  8. data/lib/overcommit/git_config.rb +1 -0
  9. data/lib/overcommit/git_repo.rb +4 -4
  10. data/lib/overcommit/hook/commit_msg/spell_check.rb +1 -1
  11. data/lib/overcommit/hook/commit_msg/text_width.rb +1 -1
  12. data/lib/overcommit/hook/post_checkout/base.rb +1 -0
  13. data/lib/overcommit/hook/post_commit/git_guilt.rb +2 -1
  14. data/lib/overcommit/hook/pre_commit/bundle_audit.rb +1 -1
  15. data/lib/overcommit/hook/pre_commit/chamber_compare.rb +5 -5
  16. data/lib/overcommit/hook/pre_commit/chamber_security.rb +1 -0
  17. data/lib/overcommit/hook/pre_commit/coffee_lint.rb +1 -1
  18. data/lib/overcommit/hook/pre_commit/css_lint.rb +1 -1
  19. data/lib/overcommit/hook/pre_commit/dart_analyzer.rb +22 -0
  20. data/lib/overcommit/hook/pre_commit/erb_lint.rb +1 -1
  21. data/lib/overcommit/hook/pre_commit/es_lint.rb +3 -6
  22. data/lib/overcommit/hook/pre_commit/fasterer.rb +1 -1
  23. data/lib/overcommit/hook/pre_commit/foodcritic.rb +3 -1
  24. data/lib/overcommit/hook/pre_commit/hlint.rb +1 -1
  25. data/lib/overcommit/hook/pre_commit/html_tidy.rb +1 -1
  26. data/lib/overcommit/hook/pre_commit/java_checkstyle.rb +1 -1
  27. data/lib/overcommit/hook/pre_commit/js_lint.rb +1 -1
  28. data/lib/overcommit/hook/pre_commit/jsl.rb +1 -1
  29. data/lib/overcommit/hook/pre_commit/kt_lint.rb +1 -1
  30. data/lib/overcommit/hook/pre_commit/license_finder.rb +1 -0
  31. data/lib/overcommit/hook/pre_commit/line_endings.rb +3 -2
  32. data/lib/overcommit/hook/pre_commit/nginx_test.rb +1 -1
  33. data/lib/overcommit/hook/pre_commit/php_cs.rb +1 -1
  34. data/lib/overcommit/hook/pre_commit/php_cs_fixer.rb +1 -1
  35. data/lib/overcommit/hook/pre_commit/php_lint.rb +3 -3
  36. data/lib/overcommit/hook/pre_commit/php_stan.rb +1 -1
  37. data/lib/overcommit/hook/pre_commit/puppet_lint.rb +1 -1
  38. data/lib/overcommit/hook/pre_commit/puppet_metadata_json_lint.rb +1 -1
  39. data/lib/overcommit/hook/pre_commit/pyflakes.rb +1 -1
  40. data/lib/overcommit/hook/pre_commit/pylint.rb +1 -1
  41. data/lib/overcommit/hook/pre_commit/python_flake8.rb +1 -1
  42. data/lib/overcommit/hook/pre_commit/rails_best_practices.rb +1 -1
  43. data/lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb +2 -2
  44. data/lib/overcommit/hook/pre_commit/rst_lint.rb +1 -1
  45. data/lib/overcommit/hook/pre_commit/scalariform.rb +1 -1
  46. data/lib/overcommit/hook/pre_commit/scalastyle.rb +1 -1
  47. data/lib/overcommit/hook/pre_commit/scss_lint.rb +3 -3
  48. data/lib/overcommit/hook/pre_commit/semi_standard.rb +1 -1
  49. data/lib/overcommit/hook/pre_commit/sqlint.rb +1 -1
  50. data/lib/overcommit/hook/pre_commit/standard.rb +1 -1
  51. data/lib/overcommit/hook/pre_commit/stylelint.rb +2 -1
  52. data/lib/overcommit/hook/pre_commit/swift_lint.rb +1 -1
  53. data/lib/overcommit/hook/pre_commit/ts_lint.rb +4 -4
  54. data/lib/overcommit/hook/pre_commit/w3c_css.rb +4 -4
  55. data/lib/overcommit/hook/pre_commit/w3c_html.rb +4 -4
  56. data/lib/overcommit/hook/pre_commit/xml_lint.rb +1 -1
  57. data/lib/overcommit/hook/pre_commit/yaml_lint.rb +25 -4
  58. data/lib/overcommit/hook/pre_commit/yaml_syntax.rb +7 -3
  59. data/lib/overcommit/hook/pre_commit/yard_coverage.rb +0 -1
  60. data/lib/overcommit/hook/pre_push/cargo_test.rb +1 -0
  61. data/lib/overcommit/hook/pre_push/flutter_test.rb +16 -0
  62. data/lib/overcommit/hook/pre_push/pub_test.rb +16 -0
  63. data/lib/overcommit/hook/prepare_commit_msg/base.rb +1 -0
  64. data/lib/overcommit/hook/prepare_commit_msg/replace_branch.rb +1 -1
  65. data/lib/overcommit/hook/shared/bower_install.rb +1 -0
  66. data/lib/overcommit/hook/shared/bundle_install.rb +1 -0
  67. data/lib/overcommit/hook/shared/composer_install.rb +1 -0
  68. data/lib/overcommit/hook/shared/npm_install.rb +1 -0
  69. data/lib/overcommit/hook/shared/pronto.rb +16 -4
  70. data/lib/overcommit/hook/shared/yarn_install.rb +1 -0
  71. data/lib/overcommit/hook_context/helpers/file_modifications.rb +1 -0
  72. data/lib/overcommit/hook_context/helpers/stash_unstaged_changes.rb +4 -1
  73. data/lib/overcommit/hook_context/post_commit.rb +1 -0
  74. data/lib/overcommit/hook_context/pre_push.rb +1 -0
  75. data/lib/overcommit/hook_context/run_all.rb +1 -0
  76. data/lib/overcommit/hook_context.rb +3 -3
  77. data/lib/overcommit/hook_loader/base.rb +3 -3
  78. data/lib/overcommit/hook_loader/plugin_hook_loader.rb +3 -3
  79. data/lib/overcommit/hook_runner.rb +8 -7
  80. data/lib/overcommit/hook_signer.rb +1 -0
  81. data/lib/overcommit/installer.rb +2 -1
  82. data/lib/overcommit/logger.rb +5 -0
  83. data/lib/overcommit/printer.rb +3 -4
  84. data/lib/overcommit/subprocess.rb +2 -1
  85. data/lib/overcommit/utils/messages_utils.rb +1 -0
  86. data/lib/overcommit/version.rb +1 -1
  87. data/libexec/index-tags +6 -4
  88. data/template-dir/hooks/commit-msg +27 -20
  89. data/template-dir/hooks/overcommit-hook +27 -20
  90. data/template-dir/hooks/post-checkout +27 -20
  91. data/template-dir/hooks/post-commit +27 -20
  92. data/template-dir/hooks/post-merge +27 -20
  93. data/template-dir/hooks/post-rewrite +27 -20
  94. data/template-dir/hooks/pre-commit +27 -20
  95. data/template-dir/hooks/pre-push +27 -20
  96. data/template-dir/hooks/pre-rebase +27 -20
  97. data/template-dir/hooks/prepare-commit-msg +27 -20
  98. metadata +20 -3
@@ -29,15 +29,22 @@ end
29
29
  # Check if Overcommit should invoke a Bundler context for loading gems
30
30
  require 'yaml'
31
31
  # rubocop:disable Style/RescueModifier
32
- if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
32
+ gemfile =
33
+ begin
34
+ YAML.load_file('.overcommit.yml', aliases: true)['gemfile']
35
+ rescue ArgumentError
36
+ YAML.load_file('.overcommit.yml')['gemfile']
37
+ end rescue nil
38
+
39
+ if gemfile
33
40
  ENV['BUNDLE_GEMFILE'] = gemfile
34
41
  require 'bundler'
35
42
 
36
43
  begin
37
44
  Bundler.setup
38
- rescue Bundler::BundlerError => ex
39
- puts "Problem loading '#{gemfile}': #{ex.message}"
40
- puts "Try running:\nbundle install --gemfile=#{gemfile}" if ex.is_a?(Bundler::GemNotFound)
45
+ rescue Bundler::BundlerError => e
46
+ puts "Problem loading '#{gemfile}': #{e.message}"
47
+ puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
41
48
  exit 78 # EX_CONFIG
42
49
  end
43
50
  end
@@ -80,37 +87,37 @@ begin
80
87
  status = runner.run
81
88
 
82
89
  exit(status ? 0 : 65) # 65 = EX_DATAERR
83
- rescue Overcommit::Exceptions::ConfigurationError => error
84
- puts error
90
+ rescue Overcommit::Exceptions::ConfigurationError => e
91
+ puts e
85
92
  exit 78 # EX_CONFIG
86
- rescue Overcommit::Exceptions::HookContextLoadError => error
87
- puts error
93
+ rescue Overcommit::Exceptions::HookContextLoadError => e
94
+ puts e
88
95
  puts 'Are you running an old version of Overcommit?'
89
96
  exit 69 # EX_UNAVAILABLE
90
97
  rescue Overcommit::Exceptions::HookLoadError,
91
- Overcommit::Exceptions::InvalidHookDefinition => error
92
- puts error.message
93
- puts error.backtrace
98
+ Overcommit::Exceptions::InvalidHookDefinition => e
99
+ puts e.message
100
+ puts e.backtrace
94
101
  exit 78 # EX_CONFIG
95
102
  rescue Overcommit::Exceptions::HookSetupFailed,
96
- Overcommit::Exceptions::HookCleanupFailed => error
97
- puts error.message
103
+ Overcommit::Exceptions::HookCleanupFailed => e
104
+ puts e.message
98
105
  exit 74 # EX_IOERR
99
106
  rescue Overcommit::Exceptions::HookCancelled
100
107
  puts 'You cancelled the hook run'
101
108
  exit 130 # Ctrl-C cancel
102
- rescue Overcommit::Exceptions::InvalidGitRepo => error
103
- puts error
109
+ rescue Overcommit::Exceptions::InvalidGitRepo => e
110
+ puts e
104
111
  exit 64 # EX_USAGE
105
- rescue Overcommit::Exceptions::ConfigurationSignatureChanged => error
106
- puts error
112
+ rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
113
+ puts e
107
114
  puts "For more information, see #{Overcommit::REPO_URL}#security"
108
115
  exit 1
109
116
  rescue Overcommit::Exceptions::InvalidHookSignature
110
117
  exit 1
111
- rescue StandardError => error
112
- puts error.message
113
- puts error.backtrace
118
+ rescue StandardError => e
119
+ puts e.message
120
+ puts e.backtrace
114
121
  puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
115
122
  exit 70 # EX_SOFTWARE
116
123
  end
@@ -29,15 +29,22 @@ end
29
29
  # Check if Overcommit should invoke a Bundler context for loading gems
30
30
  require 'yaml'
31
31
  # rubocop:disable Style/RescueModifier
32
- if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
32
+ gemfile =
33
+ begin
34
+ YAML.load_file('.overcommit.yml', aliases: true)['gemfile']
35
+ rescue ArgumentError
36
+ YAML.load_file('.overcommit.yml')['gemfile']
37
+ end rescue nil
38
+
39
+ if gemfile
33
40
  ENV['BUNDLE_GEMFILE'] = gemfile
34
41
  require 'bundler'
35
42
 
36
43
  begin
37
44
  Bundler.setup
38
- rescue Bundler::BundlerError => ex
39
- puts "Problem loading '#{gemfile}': #{ex.message}"
40
- puts "Try running:\nbundle install --gemfile=#{gemfile}" if ex.is_a?(Bundler::GemNotFound)
45
+ rescue Bundler::BundlerError => e
46
+ puts "Problem loading '#{gemfile}': #{e.message}"
47
+ puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
41
48
  exit 78 # EX_CONFIG
42
49
  end
43
50
  end
@@ -80,37 +87,37 @@ begin
80
87
  status = runner.run
81
88
 
82
89
  exit(status ? 0 : 65) # 65 = EX_DATAERR
83
- rescue Overcommit::Exceptions::ConfigurationError => error
84
- puts error
90
+ rescue Overcommit::Exceptions::ConfigurationError => e
91
+ puts e
85
92
  exit 78 # EX_CONFIG
86
- rescue Overcommit::Exceptions::HookContextLoadError => error
87
- puts error
93
+ rescue Overcommit::Exceptions::HookContextLoadError => e
94
+ puts e
88
95
  puts 'Are you running an old version of Overcommit?'
89
96
  exit 69 # EX_UNAVAILABLE
90
97
  rescue Overcommit::Exceptions::HookLoadError,
91
- Overcommit::Exceptions::InvalidHookDefinition => error
92
- puts error.message
93
- puts error.backtrace
98
+ Overcommit::Exceptions::InvalidHookDefinition => e
99
+ puts e.message
100
+ puts e.backtrace
94
101
  exit 78 # EX_CONFIG
95
102
  rescue Overcommit::Exceptions::HookSetupFailed,
96
- Overcommit::Exceptions::HookCleanupFailed => error
97
- puts error.message
103
+ Overcommit::Exceptions::HookCleanupFailed => e
104
+ puts e.message
98
105
  exit 74 # EX_IOERR
99
106
  rescue Overcommit::Exceptions::HookCancelled
100
107
  puts 'You cancelled the hook run'
101
108
  exit 130 # Ctrl-C cancel
102
- rescue Overcommit::Exceptions::InvalidGitRepo => error
103
- puts error
109
+ rescue Overcommit::Exceptions::InvalidGitRepo => e
110
+ puts e
104
111
  exit 64 # EX_USAGE
105
- rescue Overcommit::Exceptions::ConfigurationSignatureChanged => error
106
- puts error
112
+ rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
113
+ puts e
107
114
  puts "For more information, see #{Overcommit::REPO_URL}#security"
108
115
  exit 1
109
116
  rescue Overcommit::Exceptions::InvalidHookSignature
110
117
  exit 1
111
- rescue StandardError => error
112
- puts error.message
113
- puts error.backtrace
118
+ rescue StandardError => e
119
+ puts e.message
120
+ puts e.backtrace
114
121
  puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
115
122
  exit 70 # EX_SOFTWARE
116
123
  end
@@ -29,15 +29,22 @@ end
29
29
  # Check if Overcommit should invoke a Bundler context for loading gems
30
30
  require 'yaml'
31
31
  # rubocop:disable Style/RescueModifier
32
- if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
32
+ gemfile =
33
+ begin
34
+ YAML.load_file('.overcommit.yml', aliases: true)['gemfile']
35
+ rescue ArgumentError
36
+ YAML.load_file('.overcommit.yml')['gemfile']
37
+ end rescue nil
38
+
39
+ if gemfile
33
40
  ENV['BUNDLE_GEMFILE'] = gemfile
34
41
  require 'bundler'
35
42
 
36
43
  begin
37
44
  Bundler.setup
38
- rescue Bundler::BundlerError => ex
39
- puts "Problem loading '#{gemfile}': #{ex.message}"
40
- puts "Try running:\nbundle install --gemfile=#{gemfile}" if ex.is_a?(Bundler::GemNotFound)
45
+ rescue Bundler::BundlerError => e
46
+ puts "Problem loading '#{gemfile}': #{e.message}"
47
+ puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
41
48
  exit 78 # EX_CONFIG
42
49
  end
43
50
  end
@@ -80,37 +87,37 @@ begin
80
87
  status = runner.run
81
88
 
82
89
  exit(status ? 0 : 65) # 65 = EX_DATAERR
83
- rescue Overcommit::Exceptions::ConfigurationError => error
84
- puts error
90
+ rescue Overcommit::Exceptions::ConfigurationError => e
91
+ puts e
85
92
  exit 78 # EX_CONFIG
86
- rescue Overcommit::Exceptions::HookContextLoadError => error
87
- puts error
93
+ rescue Overcommit::Exceptions::HookContextLoadError => e
94
+ puts e
88
95
  puts 'Are you running an old version of Overcommit?'
89
96
  exit 69 # EX_UNAVAILABLE
90
97
  rescue Overcommit::Exceptions::HookLoadError,
91
- Overcommit::Exceptions::InvalidHookDefinition => error
92
- puts error.message
93
- puts error.backtrace
98
+ Overcommit::Exceptions::InvalidHookDefinition => e
99
+ puts e.message
100
+ puts e.backtrace
94
101
  exit 78 # EX_CONFIG
95
102
  rescue Overcommit::Exceptions::HookSetupFailed,
96
- Overcommit::Exceptions::HookCleanupFailed => error
97
- puts error.message
103
+ Overcommit::Exceptions::HookCleanupFailed => e
104
+ puts e.message
98
105
  exit 74 # EX_IOERR
99
106
  rescue Overcommit::Exceptions::HookCancelled
100
107
  puts 'You cancelled the hook run'
101
108
  exit 130 # Ctrl-C cancel
102
- rescue Overcommit::Exceptions::InvalidGitRepo => error
103
- puts error
109
+ rescue Overcommit::Exceptions::InvalidGitRepo => e
110
+ puts e
104
111
  exit 64 # EX_USAGE
105
- rescue Overcommit::Exceptions::ConfigurationSignatureChanged => error
106
- puts error
112
+ rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
113
+ puts e
107
114
  puts "For more information, see #{Overcommit::REPO_URL}#security"
108
115
  exit 1
109
116
  rescue Overcommit::Exceptions::InvalidHookSignature
110
117
  exit 1
111
- rescue StandardError => error
112
- puts error.message
113
- puts error.backtrace
118
+ rescue StandardError => e
119
+ puts e.message
120
+ puts e.backtrace
114
121
  puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
115
122
  exit 70 # EX_SOFTWARE
116
123
  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.57.0
4
+ version: 0.59.1
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-10-03 00:00:00.000000000 Z
11
+ date: 2022-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: childprocess
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.4'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rexml
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.2'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.2'
47
61
  description: Utility to install, configure, and extend Git hooks
48
62
  email:
49
63
  - shane@dasilva.io
@@ -129,6 +143,7 @@ files:
129
143
  - lib/overcommit/hook/pre_commit/cook_style.rb
130
144
  - lib/overcommit/hook/pre_commit/credo.rb
131
145
  - lib/overcommit/hook/pre_commit/css_lint.rb
146
+ - lib/overcommit/hook/pre_commit/dart_analyzer.rb
132
147
  - lib/overcommit/hook/pre_commit/dogma.rb
133
148
  - lib/overcommit/hook/pre_commit/erb_lint.rb
134
149
  - lib/overcommit/hook/pre_commit/es_lint.rb
@@ -213,12 +228,14 @@ files:
213
228
  - lib/overcommit/hook/pre_push/base.rb
214
229
  - lib/overcommit/hook/pre_push/brakeman.rb
215
230
  - lib/overcommit/hook/pre_push/cargo_test.rb
231
+ - lib/overcommit/hook/pre_push/flutter_test.rb
216
232
  - lib/overcommit/hook/pre_push/go_test.rb
217
233
  - lib/overcommit/hook/pre_push/golangci_lint.rb
218
234
  - lib/overcommit/hook/pre_push/minitest.rb
219
235
  - lib/overcommit/hook/pre_push/php_unit.rb
220
236
  - lib/overcommit/hook/pre_push/pronto.rb
221
237
  - lib/overcommit/hook/pre_push/protected_branches.rb
238
+ - lib/overcommit/hook/pre_push/pub_test.rb
222
239
  - lib/overcommit/hook/pre_push/pytest.rb
223
240
  - lib/overcommit/hook/pre_push/python_nose.rb
224
241
  - lib/overcommit/hook/pre_push/r_spec.rb
@@ -299,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
316
  - !ruby/object:Gem::Version
300
317
  version: '0'
301
318
  requirements: []
302
- rubygems_version: 3.1.1
319
+ rubygems_version: 3.1.6
303
320
  signing_key:
304
321
  specification_version: 4
305
322
  summary: Git hook manager