overcommit 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/bin/overcommit +1 -1
  3. data/config/default.yml +154 -18
  4. data/config/starter.yml +3 -3
  5. data/lib/overcommit.rb +2 -1
  6. data/lib/overcommit/cli.rb +11 -8
  7. data/lib/overcommit/configuration.rb +18 -4
  8. data/lib/overcommit/configuration_loader.rb +45 -28
  9. data/lib/overcommit/configuration_validator.rb +33 -1
  10. data/lib/overcommit/constants.rb +5 -3
  11. data/lib/overcommit/exceptions.rb +3 -0
  12. data/lib/overcommit/git_repo.rb +116 -0
  13. data/lib/overcommit/git_version.rb +15 -0
  14. data/lib/overcommit/hook/base.rb +42 -5
  15. data/lib/overcommit/hook/commit_msg/capitalized_subject.rb +13 -0
  16. data/lib/overcommit/hook/commit_msg/spell_check.rb +41 -0
  17. data/lib/overcommit/hook/post_checkout/submodule_status.rb +30 -0
  18. data/lib/overcommit/hook/post_commit/submodule_status.rb +30 -0
  19. data/lib/overcommit/hook/post_merge/submodule_status.rb +30 -0
  20. data/lib/overcommit/hook/post_rewrite/submodule_status.rb +30 -0
  21. data/lib/overcommit/hook/pre_commit/base.rb +2 -2
  22. data/lib/overcommit/hook/pre_commit/bundle_check.rb +1 -1
  23. data/lib/overcommit/hook/pre_commit/case_conflicts.rb +20 -0
  24. data/lib/overcommit/hook/pre_commit/coffee_lint.rb +29 -2
  25. data/lib/overcommit/hook/pre_commit/css_lint.rb +1 -8
  26. data/lib/overcommit/hook/pre_commit/go_lint.rb +8 -2
  27. data/lib/overcommit/hook/pre_commit/go_vet.rb +20 -0
  28. data/lib/overcommit/hook/pre_commit/html_tidy.rb +1 -10
  29. data/lib/overcommit/hook/pre_commit/image_optim.rb +11 -28
  30. data/lib/overcommit/hook/pre_commit/js_lint.rb +18 -0
  31. data/lib/overcommit/hook/pre_commit/jsl.rb +24 -0
  32. data/lib/overcommit/hook/pre_commit/json_syntax.rb +4 -7
  33. data/lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb +1 -1
  34. data/lib/overcommit/hook/pre_commit/ruby_lint.rb +19 -0
  35. data/lib/overcommit/hook/pre_commit/scss_lint.rb +8 -1
  36. data/lib/overcommit/hook/pre_commit/w3c_css.rb +4 -18
  37. data/lib/overcommit/hook/pre_commit/w3c_html.rb +4 -18
  38. data/lib/overcommit/hook/pre_commit/xml_syntax.rb +19 -0
  39. data/lib/overcommit/hook/pre_commit/yaml_syntax.rb +4 -8
  40. data/lib/overcommit/hook/pre_push/base.rb +10 -0
  41. data/lib/overcommit/hook/pre_push/protected_branches.rb +27 -0
  42. data/lib/overcommit/hook/pre_push/r_spec.rb +12 -0
  43. data/lib/overcommit/hook/pre_rebase/base.rb +11 -0
  44. data/lib/overcommit/hook_context.rb +2 -2
  45. data/lib/overcommit/hook_context/base.rb +5 -7
  46. data/lib/overcommit/hook_context/pre_commit.rb +66 -16
  47. data/lib/overcommit/hook_context/pre_push.rb +44 -0
  48. data/lib/overcommit/hook_context/pre_rebase.rb +36 -0
  49. data/lib/overcommit/hook_runner.rb +27 -7
  50. data/lib/overcommit/installer.rb +46 -7
  51. data/lib/overcommit/message_processor.rb +3 -0
  52. data/lib/overcommit/printer.rb +8 -12
  53. data/lib/overcommit/subprocess.rb +11 -0
  54. data/lib/overcommit/utils.rb +28 -6
  55. data/lib/overcommit/version.rb +1 -1
  56. data/template-dir/hooks/commit-msg +2 -2
  57. data/template-dir/hooks/overcommit-hook +2 -2
  58. data/template-dir/hooks/post-checkout +2 -2
  59. data/template-dir/hooks/post-commit +2 -2
  60. data/template-dir/hooks/post-merge +2 -2
  61. data/template-dir/hooks/post-rewrite +2 -2
  62. data/template-dir/hooks/pre-commit +2 -2
  63. data/template-dir/hooks/pre-push +81 -0
  64. data/template-dir/hooks/pre-rebase +81 -0
  65. metadata +33 -13
  66. data/lib/overcommit/hook/pre_commit/pry_binding.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc7753466602537df2c08569c1758136eec9f90b
4
- data.tar.gz: 67ed7c78239ba382a78e9f6f976ec113dc4bff67
3
+ metadata.gz: 1724df298bed7ee6665d38277209a8e87a879200
4
+ data.tar.gz: 6bb28a0b762eb3e730611210601d26da60f07a1b
5
5
  SHA512:
6
- metadata.gz: 28bba28fd0dae45783ff7c43a7d0b847547b2680e7b900569d5d4b8ba8ef0c831ae3db30391154e7e04b100fcd2818e7b66ca7ed2ef247a035a0ffccf54b85cd
7
- data.tar.gz: d7fb90d9cb74df2e57deea38fabadba464328ac8f1b445847c6c51ad7fa8a7f542c338f92d0ae1d7d115a21fdea0f9f191d94d6d3efa222d96f2567edb7e1b69
6
+ metadata.gz: 703cb3fb8202cecbe1a06723fe6f2e45ae224b4be04cc7b71f88fc4586b463bb560cefdbdb43ed635f3814c6fc9c785ee68a667d435cf959e3a3a8c2849779d6
7
+ data.tar.gz: ea54648808464b479781a4991b08de8225bd0d00b0b95813ec080e439725dcf193c56631d648a552d2694eee26d6d9fa37302faf996bbedbb01d14d68370ec85
data/bin/overcommit CHANGED
@@ -5,4 +5,4 @@ require 'overcommit/cli'
5
5
 
6
6
  logger = Overcommit::Logger.new(STDOUT)
7
7
 
8
- Overcommit::CLI.new(ARGV, logger).run
8
+ Overcommit::CLI.new(ARGV, STDIN, logger).run
data/config/default.yml CHANGED
@@ -11,7 +11,7 @@ plugin_directory: '.git-hooks'
11
11
  # Whether to check if a hook plugin has changed since Overcommit last ran it.
12
12
  # This is a defense mechanism when working with repositories which can contain
13
13
  # untrusted code (e.g. when you fetch a pull request from a third party).
14
- # See https://github.com/causes/overcommit#security for more information.
14
+ # See https://github.com/brigade/overcommit#security for more information.
15
15
  verify_plugin_signatures: true
16
16
 
17
17
  # Hooks that are run against every commit message after a user has written it.
@@ -22,27 +22,42 @@ CommitMsg:
22
22
  requires_files: false
23
23
  quiet: false
24
24
 
25
+ CapitalizedSubject:
26
+ enabled: true
27
+ description: 'Checking subject capitalization'
28
+
25
29
  GerritChangeId:
26
30
  enabled: false
27
31
  description: 'Ensuring Gerrit Change-Id is present'
28
32
  required: true
29
33
 
30
34
  HardTabs:
35
+ enabled: false
31
36
  description: 'Checking for hard tabs'
32
37
 
33
38
  RussianNovel:
39
+ enabled: false
34
40
  description: 'Checking length of commit message'
35
41
  quiet: true
36
42
 
37
43
  SingleLineSubject:
44
+ enabled: true
38
45
  description: 'Checking subject line'
39
46
 
47
+ SpellCheck:
48
+ enabled: false
49
+ description: 'Checking for misspelled words'
50
+ required_executable: 'hunspell'
51
+ flags: ['-a']
52
+
40
53
  TextWidth:
54
+ enabled: true
41
55
  description: 'Checking text width'
42
56
  max_subject_width: 60
43
57
  max_body_width: 72
44
58
 
45
59
  TrailingPeriod:
60
+ enabled: true
46
61
  description: 'Checking for trailing periods in subject'
47
62
 
48
63
  # Hooks that are run after `git commit` is executed, before the commit message
@@ -51,12 +66,13 @@ CommitMsg:
51
66
  # created.
52
67
  PreCommit:
53
68
  ALL:
54
- problem_on_unmodified_line: warn
69
+ problem_on_unmodified_line: report
55
70
  requires_files: true
56
71
  required: false
57
72
  quiet: false
58
73
 
59
74
  AuthorEmail:
75
+ enabled: true
60
76
  description: 'Checking author email'
61
77
  requires_files: false
62
78
  required: true
@@ -64,12 +80,14 @@ PreCommit:
64
80
  pattern: '^[^@]+@.*$'
65
81
 
66
82
  AuthorName:
83
+ enabled: true
67
84
  description: 'Checking for author name'
68
85
  requires_files: false
69
86
  required: true
70
87
  quiet: true
71
88
 
72
89
  BerksfileCheck:
90
+ enabled: false
73
91
  description: 'Checking Berksfile lock'
74
92
  required_executable: 'berks'
75
93
  flags: ['list', '--quiet']
@@ -88,10 +106,12 @@ PreCommit:
88
106
  - '**/*.rb'
89
107
 
90
108
  BrokenSymlinks:
109
+ enabled: true
91
110
  description: 'Checking for broken symlinks'
92
111
  quiet: true
93
112
 
94
113
  BundleCheck:
114
+ enabled: false
95
115
  description: 'Checking Gemfile dependencies'
96
116
  required_executable: 'bundle'
97
117
  flags: ['check']
@@ -101,6 +121,11 @@ PreCommit:
101
121
  - 'Gemfile.lock'
102
122
  - '*.gemspec'
103
123
 
124
+ CaseConflicts:
125
+ enabled: true
126
+ description: 'Checking for case-insensitivity conflicts'
127
+ quiet: true
128
+
104
129
  ChamberSecurity:
105
130
  enabled: false
106
131
  description: 'Checking that settings have been secured with Chamber'
@@ -112,13 +137,16 @@ PreCommit:
112
137
  - 'config/settings/**/*.yml'
113
138
 
114
139
  CoffeeLint:
140
+ enabled: false
115
141
  description: 'Analyzing with coffeelint'
116
142
  required_executable: 'coffeelint'
117
- flags: ['--quiet']
143
+ required_library: 'json'
144
+ flags: ['--reporter=raw']
118
145
  install_command: 'npm install -g coffeelint'
119
146
  include: '**/*.coffee'
120
147
 
121
148
  CssLint:
149
+ enabled: false
122
150
  description: 'Analyzing with csslint'
123
151
  required_executable: 'csslint'
124
152
  flags: ['--quiet', '--format=compact']
@@ -126,6 +154,7 @@ PreCommit:
126
154
  include: '**/*.css'
127
155
 
128
156
  EsLint:
157
+ enabled: false
129
158
  description: 'Analyzing with ESLint'
130
159
  required_executable: 'eslint'
131
160
  flags: ['--format=compact']
@@ -133,26 +162,33 @@ PreCommit:
133
162
  include: '**/*.js'
134
163
 
135
164
  GoLint:
165
+ enabled: false
136
166
  description: 'Analyzing with golint'
137
167
  required_executable: 'golint'
138
168
  install_command: 'go get github.com/golang/lint/golint'
139
169
  include: '**/*.go'
140
170
 
171
+ GoVet:
172
+ enabled: false
173
+ description: 'Analyzing with go vet'
174
+ required_executable: 'go'
175
+ flags: ['tool', 'vet']
176
+ install_command: 'go get golang.org/x/tools/cmd/vet'
177
+ include: '**/*.go'
178
+
141
179
  HamlLint:
180
+ enabled: false
142
181
  description: 'Analyzing with haml-lint'
143
182
  required_executable: 'haml-lint'
144
183
  install_command: 'gem install haml-lint'
145
184
  include: '**/*.haml'
146
185
 
147
186
  HardTabs:
187
+ enabled: false
148
188
  description: 'Checking for hard tabs'
149
189
  quiet: true
150
190
  required_executable: 'grep'
151
191
  flags: ['-IHn', "\t"]
152
- exclude:
153
- - '**/*.go'
154
- - '**/Makefile'
155
- - '.gitmodules'
156
192
 
157
193
  HtmlTidy:
158
194
  enabled: false
@@ -162,7 +198,10 @@ PreCommit:
162
198
  include: '**/*.html'
163
199
 
164
200
  ImageOptim:
201
+ enabled: false
165
202
  description: 'Checking for optimizable images'
203
+ required_executable: 'image_optim'
204
+ install_command: 'gem install image_optim'
166
205
  include:
167
206
  - '**/*.gif'
168
207
  - '**/*.jpg'
@@ -170,12 +209,14 @@ PreCommit:
170
209
  - '**/*.png'
171
210
 
172
211
  JavaCheckstyle:
212
+ enabled: false
173
213
  description: 'Analyzing with checkstyle'
174
214
  required_executable: 'checkstyle'
175
215
  flags: ['-c', '/sun_checks.xml']
176
216
  include: '**/*.java'
177
217
 
178
218
  Jscs:
219
+ enabled: false
179
220
  description: 'Analyzing with JSCS'
180
221
  required_executable: 'jscs'
181
222
  flags: ['--reporter=inline', '--verbose']
@@ -183,29 +224,51 @@ PreCommit:
183
224
  include: '**/*.js'
184
225
 
185
226
  JsHint:
227
+ enabled: false
186
228
  description: 'Analyzing with JSHint'
187
229
  required_executable: 'jshint'
188
230
  flags: ['--verbose']
189
231
  install_command: 'npm install -g jshint'
190
232
  include: '**/*.js'
191
233
 
234
+ JsLint:
235
+ enabled: false
236
+ description: 'Analyzing with JSLint'
237
+ required_executable: 'jslint'
238
+ flags: ['--terse']
239
+ install_command: 'npm install -g jslint'
240
+ include: '**/*.js'
241
+
242
+ Jsl:
243
+ enabled: false
244
+ description: 'Analyzing with JSL'
245
+ required_executable: 'jsl'
246
+ flags: ['-nologo', '-nofilelisting', '-nocontext', '-nosummary']
247
+ include: '**/*.js'
248
+
192
249
  JsonSyntax:
250
+ enabled: false
193
251
  description: 'Validating JSON syntax'
252
+ required_library: 'json'
253
+ install_command: 'gem install json'
194
254
  include: '**/*.json'
195
255
 
196
256
  LocalPathsInGemfile:
257
+ enabled: false
197
258
  description: 'Checking for local paths in Gemfile'
198
259
  required_executable: 'grep'
199
- flags: ['-IHnE', '(\bpath:)|(:path\s*=>)']
260
+ flags: ['-IHnE', '^[^#]*((\bpath:)|(:path\s*=>))']
200
261
  include: '**/Gemfile'
201
262
 
202
263
  MergeConflicts:
264
+ enabled: true
203
265
  description: 'Checking for merge conflicts'
204
266
  quiet: true
205
267
  required_executable: 'grep'
206
268
  flags: ['-IHn', '^<<<<<<<\s']
207
269
 
208
270
  Pep257:
271
+ enabled: false
209
272
  description: 'Analyzing docstrings with pep257'
210
273
  required_executable: 'pep257'
211
274
  install_command: 'pip install pep257'
@@ -218,13 +281,6 @@ PreCommit:
218
281
  install_command: 'pip install pep8'
219
282
  include: '**/*.py'
220
283
 
221
- PryBinding:
222
- description: 'Checking for instances of binding.pry'
223
- quiet: true
224
- include:
225
- - '**/*.rb'
226
- - '**/*.rake'
227
-
228
284
  Pyflakes:
229
285
  enabled: false
230
286
  description: 'Analyzing with pyflakes'
@@ -233,6 +289,7 @@ PreCommit:
233
289
  include: '**/*.py'
234
290
 
235
291
  Pylint:
292
+ enabled: false
236
293
  description: 'Analyzing with Pylint'
237
294
  required_executable: 'pylint'
238
295
  install_command: 'pip install pylint'
@@ -243,12 +300,14 @@ PreCommit:
243
300
  include: '**/*.py'
244
301
 
245
302
  PythonFlake8:
303
+ enabled: false
246
304
  description: 'Analyzing with flake8'
247
305
  required_executable: 'flake8'
248
306
  install_command: 'pip install flake8'
249
307
  include: '**/*.py'
250
308
 
251
309
  RailsSchemaUpToDate:
310
+ enabled: false
252
311
  description: 'Checking if database schema is up to date'
253
312
  include:
254
313
  - 'db/migrate/*.rb'
@@ -269,9 +328,10 @@ PreCommit:
269
328
  - '**/Rakefile'
270
329
 
271
330
  Rubocop:
331
+ enabled: false
272
332
  description: 'Analyzing with Rubocop'
273
333
  required_executable: 'rubocop'
274
- flags: ['--format=emacs', '--force-exclusion']
334
+ flags: ['--format=emacs', '--force-exclusion', '--display-cop-names']
275
335
  install_command: 'gem install rubocop'
276
336
  include:
277
337
  - '**/*.gemspec'
@@ -280,12 +340,24 @@ PreCommit:
280
340
  - '**/Gemfile'
281
341
  - '**/Rakefile'
282
342
 
343
+ RubyLint:
344
+ enabled: false
345
+ description: 'Analyzing with ruby-lint'
346
+ required_executable: 'ruby-lint'
347
+ flags: ['--presenter=syntastic', '--levels=error,warning']
348
+ install_command: 'gem install ruby-lint'
349
+ include:
350
+ - '**/*.gemspec'
351
+ - '**/*.rb'
352
+
283
353
  Scalastyle:
354
+ enabled: false
284
355
  description: 'Analyzing with Scalastyle'
285
356
  required_executable: 'scalastyle'
286
357
  include: '**/*.scala'
287
358
 
288
359
  ScssLint:
360
+ enabled: false
289
361
  description: 'Analyzing with scss-lint'
290
362
  required_executable: 'scss-lint'
291
363
  install_command: 'gem install scss-lint'
@@ -300,6 +372,7 @@ PreCommit:
300
372
  include: '**/*.js'
301
373
 
302
374
  ShellCheck:
375
+ enabled: false
303
376
  description: 'Analyzing with ShellCheck'
304
377
  required_executable: 'shellcheck'
305
378
  flags: ['--format=gcc']
@@ -314,13 +387,13 @@ PreCommit:
314
387
  include: '**/*.js'
315
388
 
316
389
  TrailingWhitespace:
390
+ enabled: false
317
391
  description: 'Checking for trailing whitespace'
318
392
  required_executable: 'grep'
319
393
  flags: ['-IHn', '\s$']
320
- exclude:
321
- - '**/db/structure.sql'
322
394
 
323
395
  TravisLint:
396
+ enabled: false
324
397
  description: 'Checking Travis CI configuration'
325
398
  required_executable: 'travis'
326
399
  flags: ['lint']
@@ -330,6 +403,8 @@ PreCommit:
330
403
  W3cCss:
331
404
  enabled: false
332
405
  description: 'Analyzing with W3C CSS validation service'
406
+ required_library: 'w3c_validators'
407
+ install_command: 'gem install w3c_validators'
333
408
  validator_uri: 'http://jigsaw.w3.org/css-validator/validator'
334
409
  language: 'en'
335
410
  profile: 'css3'
@@ -340,6 +415,8 @@ PreCommit:
340
415
  W3cHtml:
341
416
  enabled: false
342
417
  description: 'Analyzing with W3C HTML validation service'
418
+ required_library: 'w3c_validators'
419
+ install_command: 'gem install w3c_validators'
343
420
  validator_uri: 'http://validator.w3.org/check'
344
421
  charset: 'utf-8'
345
422
  doctype: 'HTML5'
@@ -347,13 +424,22 @@ PreCommit:
347
424
  - '**/*.html'
348
425
 
349
426
  XmlLint:
427
+ enabled: false
350
428
  description: 'Analyzing with xmllint'
351
429
  required_executable: 'xmllint'
352
430
  flags: ['--noout']
353
431
  include: '**/*.xml'
354
432
 
433
+ XmlSyntax:
434
+ enabled: false
435
+ description: 'Checking XML syntax'
436
+ required_library: 'rexml/document'
437
+ include: '**/*.xml'
438
+
355
439
  YamlSyntax:
440
+ enabled: false
356
441
  description: 'Checking YAML syntax'
442
+ required_library: 'yaml'
357
443
  include:
358
444
  - '**/*.yaml'
359
445
  - '**/*.yml'
@@ -369,6 +455,12 @@ PostCheckout:
369
455
  description: 'Generating tags file from source'
370
456
  required_executable: 'ctags'
371
457
 
458
+ SubmoduleStatus:
459
+ enabled: false
460
+ description: 'Checking submodule status'
461
+ quiet: true
462
+ recursive: false
463
+
372
464
  # Hooks that run after a commit is created.
373
465
  PostCommit:
374
466
  ALL:
@@ -389,6 +481,12 @@ PostCommit:
389
481
  description: 'Generating tags file from source'
390
482
  required_executable: 'ctags'
391
483
 
484
+ SubmoduleStatus:
485
+ enabled: false
486
+ description: 'Checking submodule status'
487
+ quiet: true
488
+ recursive: false
489
+
392
490
  # Hooks that run after `git merge` executes successfully (no merge conflicts).
393
491
  PostMerge:
394
492
  ALL:
@@ -400,6 +498,12 @@ PostMerge:
400
498
  description: 'Generating tags file from source'
401
499
  required_executable: 'ctags'
402
500
 
501
+ SubmoduleStatus:
502
+ enabled: false
503
+ description: 'Checking submodule status'
504
+ quiet: true
505
+ recursive: false
506
+
403
507
  # Hooks that run after a commit is modified by an amend or rebase.
404
508
  PostRewrite:
405
509
  ALL:
@@ -410,3 +514,35 @@ PostRewrite:
410
514
  enabled: false
411
515
  description: 'Generating tags file from source'
412
516
  required_executable: 'ctags'
517
+
518
+ SubmoduleStatus:
519
+ enabled: false
520
+ description: 'Checking submodule status'
521
+ quiet: true
522
+ recursive: false
523
+
524
+ # Hooks that run during `git push`, after remote refs have been updated but
525
+ # before any objects have been transferred.
526
+ PrePush:
527
+ ALL:
528
+ requires_files: false
529
+ required: false
530
+ quiet: false
531
+
532
+ ProtectedBranches:
533
+ enabled: false
534
+ description: 'Checking for illegal pushes to protected branches'
535
+ branches: ['master']
536
+
537
+ RSpec:
538
+ enabled: false
539
+ description: 'Running RSpec test suite'
540
+ required_executable: 'rspec'
541
+
542
+ # Hooks that run during `git rebase`, before any commits are rebased.
543
+ # If a hook fails, the rebase is aborted.
544
+ PreRebase:
545
+ ALL:
546
+ requires_files: false
547
+ required: false
548
+ quiet: false