overcommit 0.32.0.rc1 → 0.32.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
  SHA1:
3
- metadata.gz: b45a46c1290a6ddd0fd418f28012e7138f01470e
4
- data.tar.gz: 1443470dae06fb17b84fe99823d8e2c655bdb792
3
+ metadata.gz: e0c2c570d206163b748a1aefa226cacfbe1987a6
4
+ data.tar.gz: fd391b54a75ca207031562fc896d2dfa57494088
5
5
  SHA512:
6
- metadata.gz: 133dc22840e178a2473670780a385fb0b4c46a48d175c5ab7ad391eccfb0fc1517a1f4318f8ad91e1ef53ca40cd2925d3e3912fb203b91e8aeeb8a9285892df1
7
- data.tar.gz: 0847b5f3045de5b413be8704a76fbd6fdef908a34e11b64414a58628eadc3f961d77efa1e2257ef0a7b77b6e861b2496a1ec97f5752a02cbe1f9a17fe1cd1adb
6
+ metadata.gz: df5aecb87481a132a0fc6b0d5ee0ac651a9ca74ba962a0563fc66b5a5583d19aad33293e25bd71626aecbdfe186d7af0e2be1bbda440c8ec2ffc5b5c4507dc8e
7
+ data.tar.gz: d2eb883b0d1bb0bfd0a4b970150e466eb5a5fe5631d49d876b8c9b751463120efb99a9c788c2079b6907679dbc778b6ab780fed382c14d510df702ee406988da
@@ -62,46 +62,53 @@ CommitMsg:
62
62
 
63
63
  CapitalizedSubject:
64
64
  enabled: true
65
- description: 'Checking subject capitalization'
65
+ description: 'Check subject capitalization'
66
66
 
67
67
  EmptyMessage:
68
68
  enabled: true
69
- description: 'Checking for empty commit message'
69
+ description: 'Check for empty commit message'
70
70
  quiet: true
71
71
 
72
72
  GerritChangeId:
73
73
  enabled: false
74
- description: 'Ensuring Gerrit Change-Id is present'
74
+ description: 'Ensure Gerrit Change-Id is present'
75
75
  required: true
76
76
 
77
77
  HardTabs:
78
78
  enabled: false
79
- description: 'Checking for hard tabs'
79
+ description: 'Check for hard tabs'
80
+
81
+ MessageFormat:
82
+ enabled: false
83
+ description: 'Check commit message matches expected pattern'
84
+ pattern: '(.+)[|](.+)[|](.+)'
85
+ expected_pattern_message: '<Issue Id> | <Commit Message Description> | <Developer(s)>'
86
+ sample_message: 'DEFECT-1234 | Refactored Onboarding flow | John Doe'
80
87
 
81
88
  RussianNovel:
82
89
  enabled: false
83
- description: 'Checking length of commit message'
90
+ description: 'Check length of commit message'
84
91
  quiet: true
85
92
 
86
93
  SingleLineSubject:
87
94
  enabled: true
88
- description: 'Checking subject line'
95
+ description: 'Check subject line'
89
96
 
90
97
  SpellCheck:
91
98
  enabled: false
92
- description: 'Checking for misspelled words'
99
+ description: 'Check for misspelled words'
93
100
  required_executable: 'hunspell'
94
101
  flags: ['-a']
95
102
 
96
103
  TextWidth:
97
104
  enabled: true
98
- description: 'Checking text width'
105
+ description: 'Check text width'
99
106
  max_subject_width: 60
100
107
  max_body_width: 72
101
108
 
102
109
  TrailingPeriod:
103
110
  enabled: true
104
- description: 'Checking for trailing periods in subject'
111
+ description: 'Check for trailing periods in subject'
105
112
 
106
113
  # Hooks that are run after `git commit` is executed, before the commit message
107
114
  # editor is displayed. These hooks are ideal for syntax checkers, linters, and
@@ -116,7 +123,7 @@ PreCommit:
116
123
 
117
124
  AuthorEmail:
118
125
  enabled: true
119
- description: 'Checking author email'
126
+ description: 'Check author email'
120
127
  requires_files: false
121
128
  required: true
122
129
  quiet: true
@@ -124,14 +131,14 @@ PreCommit:
124
131
 
125
132
  AuthorName:
126
133
  enabled: true
127
- description: 'Checking for author name'
134
+ description: 'Check for author name'
128
135
  requires_files: false
129
136
  required: true
130
137
  quiet: true
131
138
 
132
139
  BerksfileCheck:
133
140
  enabled: false
134
- description: 'Checking Berksfile lock'
141
+ description: 'Check Berksfile lock'
135
142
  required_executable: 'berks'
136
143
  flags: ['list', '--quiet']
137
144
  install_command: 'gem install berks'
@@ -141,7 +148,7 @@ PreCommit:
141
148
 
142
149
  Brakeman:
143
150
  enabled: false
144
- description: 'Checking for security vulnerabilities'
151
+ description: 'Check for security vulnerabilities'
145
152
  required_executable: 'brakeman'
146
153
  flags: ['--exit-on-warn', '--quiet', '--summary', '--only-files']
147
154
  install_command: 'gem install brakeman'
@@ -150,12 +157,12 @@ PreCommit:
150
157
 
151
158
  BrokenSymlinks:
152
159
  enabled: true
153
- description: 'Checking for broken symlinks'
160
+ description: 'Check for broken symlinks'
154
161
  quiet: true
155
162
 
156
163
  BundleCheck:
157
164
  enabled: false
158
- description: 'Checking Gemfile dependencies'
165
+ description: 'Check Gemfile dependencies'
159
166
  required_executable: 'bundle'
160
167
  flags: ['check']
161
168
  install_command: 'gem install bundler'
@@ -166,12 +173,12 @@ PreCommit:
166
173
 
167
174
  CaseConflicts:
168
175
  enabled: true
169
- description: 'Checking for case-insensitivity conflicts'
176
+ description: 'Check for case-insensitivity conflicts'
170
177
  quiet: true
171
178
 
172
179
  ChamberSecurity:
173
180
  enabled: false
174
- description: 'Checking that settings have been secured with Chamber'
181
+ description: 'Check that settings have been secured with Chamber'
175
182
  required_executable: 'chamber'
176
183
  flags: ['secure', '--files']
177
184
  install_command: 'gem install chamber'
@@ -181,7 +188,7 @@ PreCommit:
181
188
 
182
189
  CoffeeLint:
183
190
  enabled: false
184
- description: 'Analyzing with coffeelint'
191
+ description: 'Analyze with coffeelint'
185
192
  required_executable: 'coffeelint'
186
193
  flags: ['--reporter=csv']
187
194
  install_command: 'npm install -g coffeelint'
@@ -189,7 +196,7 @@ PreCommit:
189
196
 
190
197
  CssLint:
191
198
  enabled: false
192
- description: 'Analyzing with csslint'
199
+ description: 'Analyze with csslint'
193
200
  required_executable: 'csslint'
194
201
  flags: ['--quiet', '--format=compact']
195
202
  install_command: 'npm install -g csslint'
@@ -197,7 +204,7 @@ PreCommit:
197
204
 
198
205
  Dogma:
199
206
  enabled: false
200
- description: 'Analyzing with dogma'
207
+ description: 'Analyze with dogma'
201
208
  required_executable: 'mix'
202
209
  flags: ['dogma']
203
210
  include:
@@ -206,7 +213,7 @@ PreCommit:
206
213
 
207
214
  EsLint:
208
215
  enabled: false
209
- description: 'Analyzing with ESLint'
216
+ description: 'Analyze with ESLint'
210
217
  required_executable: 'eslint'
211
218
  flags: ['--format=compact']
212
219
  install_command: 'npm install -g eslint'
@@ -214,19 +221,25 @@ PreCommit:
214
221
 
215
222
  ExecutePermissions:
216
223
  enabled: false
217
- description: 'Checking for file execute permissions'
224
+ description: 'Check for file execute permissions'
225
+ quiet: true
226
+
227
+ ForbiddenBranches:
228
+ enabled: false
229
+ description: 'Check for commit to forbidden branch'
218
230
  quiet: true
231
+ branch_patterns: ['master']
219
232
 
220
233
  GoLint:
221
234
  enabled: false
222
- description: 'Analyzing with golint'
235
+ description: 'Analyze with golint'
223
236
  required_executable: 'golint'
224
237
  install_command: 'go get github.com/golang/lint/golint'
225
238
  include: '**/*.go'
226
239
 
227
240
  GoVet:
228
241
  enabled: false
229
- description: 'Analyzing with go vet'
242
+ description: 'Analyze with go vet'
230
243
  required_executable: 'go'
231
244
  flags: ['tool', 'vet']
232
245
  install_command: 'go get golang.org/x/tools/cmd/vet'
@@ -234,42 +247,42 @@ PreCommit:
234
247
 
235
248
  HamlLint:
236
249
  enabled: false
237
- description: 'Analyzing with haml-lint'
250
+ description: 'Analyze with haml-lint'
238
251
  required_executable: 'haml-lint'
239
252
  install_command: 'gem install haml-lint'
240
253
  include: '**/*.haml'
241
254
 
242
255
  HardTabs:
243
256
  enabled: false
244
- description: 'Checking for hard tabs'
257
+ description: 'Check for hard tabs'
245
258
  quiet: true
246
259
  required_executable: 'grep'
247
260
  flags: ['-IHn', "\t"]
248
261
 
249
262
  Hlint:
250
263
  enabled: false
251
- description: 'Analyzing with hlint'
264
+ description: 'Analyze with hlint'
252
265
  required_executable: 'hlint'
253
266
  install_command: 'cabal install hlint'
254
267
  include: '**/*.hs'
255
268
 
256
269
  HtmlHint:
257
270
  enabled: false
258
- description: 'Analyzing with HTMLHint'
271
+ description: 'Analyze with HTMLHint'
259
272
  required_executable: 'htmlhint'
260
273
  install_command: 'npm install -g htmlhint'
261
274
  include: '**/*.html'
262
275
 
263
276
  HtmlTidy:
264
277
  enabled: false
265
- description: 'Analyzing HTML with tidy'
278
+ description: 'Analyze HTML with tidy'
266
279
  required_executable: 'tidy'
267
280
  flags: ['-errors', '-quiet', '-utf8']
268
281
  include: '**/*.html'
269
282
 
270
283
  ImageOptim:
271
284
  enabled: false
272
- description: 'Checking for optimizable images'
285
+ description: 'Check for optimizable images'
273
286
  required_executable: 'image_optim'
274
287
  install_command: 'gem install image_optim'
275
288
  include:
@@ -281,14 +294,14 @@ PreCommit:
281
294
 
282
295
  JavaCheckstyle:
283
296
  enabled: false
284
- description: 'Analyzing with checkstyle'
297
+ description: 'Analyze with checkstyle'
285
298
  required_executable: 'checkstyle'
286
299
  flags: ['-c', '/sun_checks.xml']
287
300
  include: '**/*.java'
288
301
 
289
302
  Jscs:
290
303
  enabled: false
291
- description: 'Analyzing with JSCS'
304
+ description: 'Analyze with JSCS'
292
305
  required_executable: 'jscs'
293
306
  flags: ['--reporter=inline', '--verbose']
294
307
  install_command: 'npm install -g jscs'
@@ -296,7 +309,7 @@ PreCommit:
296
309
 
297
310
  JsHint:
298
311
  enabled: false
299
- description: 'Analyzing with JSHint'
312
+ description: 'Analyze with JSHint'
300
313
  required_executable: 'jshint'
301
314
  flags: ['--verbose']
302
315
  install_command: 'npm install -g jshint'
@@ -304,7 +317,7 @@ PreCommit:
304
317
 
305
318
  JsLint:
306
319
  enabled: false
307
- description: 'Analyzing with JSLint'
320
+ description: 'Analyze with JSLint'
308
321
  required_executable: 'jslint'
309
322
  flags: ['--terse']
310
323
  install_command: 'npm install -g jslint'
@@ -312,63 +325,63 @@ PreCommit:
312
325
 
313
326
  Jsl:
314
327
  enabled: false
315
- description: 'Analyzing with JSL'
328
+ description: 'Analyze with JSL'
316
329
  required_executable: 'jsl'
317
330
  flags: ['-nologo', '-nofilelisting', '-nocontext', '-nosummary']
318
331
  include: '**/*.js'
319
332
 
320
333
  JsonSyntax:
321
334
  enabled: false
322
- description: 'Validating JSON syntax'
335
+ description: 'Validate JSON syntax'
323
336
  required_library: 'json'
324
337
  install_command: 'gem install json'
325
338
  include: '**/*.json'
326
339
 
327
340
  LocalPathsInGemfile:
328
341
  enabled: false
329
- description: 'Checking for local paths in Gemfile'
342
+ description: 'Check for local paths in Gemfile'
330
343
  required_executable: 'grep'
331
344
  flags: ['-IHnE', "^[^#]*((\\bpath:)|(:path[ \t]*=>))"]
332
345
  include: '**/Gemfile'
333
346
 
334
347
  Mdl:
335
348
  enabled: false
336
- description: 'Analyzing with mdl'
349
+ description: 'Analyze with mdl'
337
350
  required_executable: 'mdl'
338
351
  install_command: 'gem install mdl'
339
352
  include: '**/*.md'
340
353
 
341
354
  MergeConflicts:
342
355
  enabled: true
343
- description: 'Checking for merge conflicts'
356
+ description: 'Check for merge conflicts'
344
357
  quiet: true
345
358
  required_executable: 'grep'
346
359
  flags: ['-IHn', "^<<<<<<<[ \t]"]
347
360
 
348
361
  NginxTest:
349
362
  enabled: false
350
- description: 'Testing nginx configs'
363
+ description: 'Test nginx configs'
351
364
  required_executable: 'nginx'
352
365
  flags: ['-t']
353
366
  include: '**/nginx.conf'
354
367
 
355
368
  Pep257:
356
369
  enabled: false
357
- description: 'Analyzing docstrings with pep257'
370
+ description: 'Analyze docstrings with pep257'
358
371
  required_executable: 'pep257'
359
372
  install_command: 'pip install pep257'
360
373
  include: '**/*.py'
361
374
 
362
375
  Pep8:
363
376
  enabled: false
364
- description: 'Analyzing with pep8'
377
+ description: 'Analyze with pep8'
365
378
  required_executable: 'pep8'
366
379
  install_command: 'pip install pep8'
367
380
  include: '**/*.py'
368
381
 
369
382
  PuppetLint:
370
383
  enabled: false
371
- description: 'Analyzing with puppet-lint'
384
+ description: 'Analyze with puppet-lint'
372
385
  required_executable: 'puppet-lint'
373
386
  install_command: 'gem install puppet-lint'
374
387
  flags:
@@ -379,14 +392,14 @@ PreCommit:
379
392
 
380
393
  Pyflakes:
381
394
  enabled: false
382
- description: 'Analyzing with pyflakes'
395
+ description: 'Analyze with pyflakes'
383
396
  required_executable: 'pyflakes'
384
397
  install_command: 'pip install pyflakes'
385
398
  include: '**/*.py'
386
399
 
387
400
  Pylint:
388
401
  enabled: false
389
- description: 'Analyzing with Pylint'
402
+ description: 'Analyze with Pylint'
390
403
  required_executable: 'pylint'
391
404
  install_command: 'pip install pylint'
392
405
  flags:
@@ -397,21 +410,21 @@ PreCommit:
397
410
 
398
411
  PythonFlake8:
399
412
  enabled: false
400
- description: 'Analyzing with flake8'
413
+ description: 'Analyze with flake8'
401
414
  required_executable: 'flake8'
402
415
  install_command: 'pip install flake8'
403
416
  include: '**/*.py'
404
417
 
405
418
  RailsBestPractices:
406
419
  enabled: false
407
- description: 'Analyzing with RailsBestPractices'
420
+ description: 'Analyze with RailsBestPractices'
408
421
  required_executable: 'rails_best_practices'
409
422
  flags: ['--without-color']
410
423
  install_command: 'gem install rails_best_practices'
411
424
 
412
425
  RailsSchemaUpToDate:
413
426
  enabled: false
414
- description: 'Checking if database schema is up to date'
427
+ description: 'Check if database schema is up to date'
415
428
  include:
416
429
  - 'db/migrate/*.rb'
417
430
  - 'db/schema.rb'
@@ -419,7 +432,7 @@ PreCommit:
419
432
 
420
433
  Reek:
421
434
  enabled: false
422
- description: 'Analyzing with Reek'
435
+ description: 'Analyze with Reek'
423
436
  required_executable: 'reek'
424
437
  flags: ['--single-line', '--no-color']
425
438
  install_command: 'gem install reek'
@@ -432,7 +445,7 @@ PreCommit:
432
445
 
433
446
  RuboCop:
434
447
  enabled: false
435
- description: 'Analyzing with RuboCop'
448
+ description: 'Analyze with RuboCop'
436
449
  required_executable: 'rubocop'
437
450
  flags: ['--format=emacs', '--force-exclusion', '--display-cop-names']
438
451
  install_command: 'gem install rubocop'
@@ -445,7 +458,7 @@ PreCommit:
445
458
 
446
459
  RubyLint:
447
460
  enabled: false
448
- description: 'Analyzing with ruby-lint'
461
+ description: 'Analyze with ruby-lint'
449
462
  required_executable: 'ruby-lint'
450
463
  flags: ['--presenter=syntastic', '--levels=error,warning']
451
464
  install_command: 'gem install ruby-lint'
@@ -455,27 +468,29 @@ PreCommit:
455
468
 
456
469
  Scalariform:
457
470
  enabled: false
458
- description: 'Checking formatting with Scalariform'
471
+ description: 'Check formatting with Scalariform'
459
472
  required_executable: 'scalariform'
460
473
  flags: ['--test']
461
474
  include: '**/*.scala'
462
475
 
463
476
  Scalastyle:
464
477
  enabled: false
465
- description: 'Analyzing with Scalastyle'
478
+ description: 'Analyze with Scalastyle'
466
479
  required_executable: 'scalastyle'
467
480
  include: '**/*.scala'
468
481
 
469
482
  ScssLint:
470
483
  enabled: false
471
- description: 'Analyzing with scss-lint'
484
+ description: 'Analyze with scss-lint'
485
+ required_library: 'json'
472
486
  required_executable: 'scss-lint'
487
+ flags: ['--format', 'JSON']
473
488
  install_command: 'gem install scss-lint'
474
489
  include: '**/*.scss'
475
490
 
476
491
  SemiStandard:
477
492
  enabled: false
478
- description: 'Analyzing with semistandard'
493
+ description: 'Analyze with semistandard'
479
494
  required_executable: 'semistandard'
480
495
  flags: ['--verbose']
481
496
  install_command: 'npm install -g semistandard'
@@ -483,28 +498,28 @@ PreCommit:
483
498
 
484
499
  ShellCheck:
485
500
  enabled: false
486
- description: 'Analyzing with ShellCheck'
501
+ description: 'Analyze with ShellCheck'
487
502
  required_executable: 'shellcheck'
488
503
  flags: ['--format=gcc']
489
504
  include: '**/*.sh'
490
505
 
491
506
  SlimLint:
492
507
  enabled: false
493
- description: 'Analyzing with slim-lint'
508
+ description: 'Analyze with slim-lint'
494
509
  required_executable: 'slim-lint'
495
510
  install_command: 'gem install slim_lint'
496
511
  include: '**/*.slim'
497
512
 
498
513
  Sqlint:
499
514
  enabled: false
500
- description: 'Analyzing with sqlint'
515
+ description: 'Analyze with sqlint'
501
516
  required_executable: 'sqlint'
502
517
  install_command: 'gem install sqlint'
503
518
  include: '**/*.sql'
504
519
 
505
520
  Standard:
506
521
  enabled: false
507
- description: 'Analyzing with standard'
522
+ description: 'Analyze with standard'
508
523
  required_executable: 'standard'
509
524
  flags: ['--verbose']
510
525
  install_command: 'npm install -g standard'
@@ -512,13 +527,13 @@ PreCommit:
512
527
 
513
528
  TrailingWhitespace:
514
529
  enabled: false
515
- description: 'Checking for trailing whitespace'
530
+ description: 'Check for trailing whitespace'
516
531
  required_executable: 'grep'
517
532
  flags: ['-IHn', "[ \t]$"]
518
533
 
519
534
  TravisLint:
520
535
  enabled: false
521
- description: 'Checking Travis CI configuration'
536
+ description: 'Check Travis CI configuration'
522
537
  required_executable: 'travis'
523
538
  flags: ['lint']
524
539
  install_command: 'gem install travis'
@@ -526,7 +541,7 @@ PreCommit:
526
541
 
527
542
  Vint:
528
543
  enabled: false
529
- description: 'Analyzing with Vint'
544
+ description: 'Analyze with Vint'
530
545
  required_executable: 'vint'
531
546
  install_command: 'pip install vim-vint'
532
547
  include:
@@ -535,7 +550,7 @@ PreCommit:
535
550
 
536
551
  W3cCss:
537
552
  enabled: false
538
- description: 'Analyzing with W3C CSS validation service'
553
+ description: 'Analyze with W3C CSS validation service'
539
554
  required_library: 'w3c_validators'
540
555
  install_command: 'gem install w3c_validators'
541
556
  validator_uri: 'http://jigsaw.w3.org/css-validator/validator'
@@ -547,7 +562,7 @@ PreCommit:
547
562
 
548
563
  W3cHtml:
549
564
  enabled: false
550
- description: 'Analyzing with W3C HTML validation service'
565
+ description: 'Analyze with W3C HTML validation service'
551
566
  required_library: 'w3c_validators'
552
567
  install_command: 'gem install w3c_validators'
553
568
  validator_uri: 'http://validator.w3.org/check'
@@ -558,7 +573,7 @@ PreCommit:
558
573
 
559
574
  XmlLint:
560
575
  enabled: false
561
- description: 'Analyzing with xmllint'
576
+ description: 'Analyze with xmllint'
562
577
  required_executable: 'xmllint'
563
578
  flags: ['--noout']
564
579
  include:
@@ -567,7 +582,7 @@ PreCommit:
567
582
 
568
583
  XmlSyntax:
569
584
  enabled: false
570
- description: 'Checking XML syntax'
585
+ description: 'Check XML syntax'
571
586
  required_library: 'rexml/document'
572
587
  include:
573
588
  - '**/*.xml'
@@ -575,7 +590,7 @@ PreCommit:
575
590
 
576
591
  YamlSyntax:
577
592
  enabled: false
578
- description: 'Checking YAML syntax'
593
+ description: 'Check YAML syntax'
579
594
  required_library: 'yaml'
580
595
  include:
581
596
  - '**/*.yaml'
@@ -589,7 +604,7 @@ PostCheckout:
589
604
 
590
605
  BowerInstall:
591
606
  enabled: false
592
- description: 'Installing bower dependencies'
607
+ description: 'Install bower dependencies'
593
608
  requires_files: true
594
609
  required_executable: 'bower'
595
610
  install_command: 'npm install -g bower'
@@ -598,7 +613,7 @@ PostCheckout:
598
613
 
599
614
  BundleInstall:
600
615
  enabled: false
601
- description: 'Installing Bundler dependencies'
616
+ description: 'Install Bundler dependencies'
602
617
  requires_files: true
603
618
  required_executable: 'bundle'
604
619
  install_command: 'gem install bundler'
@@ -610,13 +625,13 @@ PostCheckout:
610
625
 
611
626
  IndexTags:
612
627
  enabled: false
613
- description: 'Generating tags file from source'
628
+ description: 'Generate tags file from source'
614
629
  quiet: true
615
630
  required_executable: 'ctags'
616
631
 
617
632
  NpmInstall:
618
633
  enabled: false
619
- description: 'Installing NPM dependencies'
634
+ description: 'Install NPM dependencies'
620
635
  requires_files: true
621
636
  required_executable: 'npm'
622
637
  flags: ['install']
@@ -626,7 +641,7 @@ PostCheckout:
626
641
 
627
642
  SubmoduleStatus:
628
643
  enabled: false
629
- description: 'Checking submodule status'
644
+ description: 'Check submodule status'
630
645
  quiet: true
631
646
  recursive: false
632
647
 
@@ -639,7 +654,7 @@ PostCommit:
639
654
 
640
655
  BowerInstall:
641
656
  enabled: false
642
- description: 'Installing bower dependencies'
657
+ description: 'Install bower dependencies'
643
658
  requires_files: true
644
659
  required_executable: 'bower'
645
660
  install_command: 'npm install -g bower'
@@ -648,7 +663,7 @@ PostCommit:
648
663
 
649
664
  BundleInstall:
650
665
  enabled: false
651
- description: 'Installing Bundler dependencies'
666
+ description: 'Install Bundler dependencies'
652
667
  requires_files: true
653
668
  required_executable: 'bundle'
654
669
  install_command: 'gem install bundler'
@@ -660,7 +675,7 @@ PostCommit:
660
675
 
661
676
  GitGuilt:
662
677
  enabled: false
663
- description: 'Calculating changes in blame since last commit'
678
+ description: 'Calculate changes in blame since last commit'
664
679
  requires_files: true
665
680
  required_executable: 'git-guilt'
666
681
  flags: ['HEAD~', 'HEAD']
@@ -668,13 +683,13 @@ PostCommit:
668
683
 
669
684
  IndexTags:
670
685
  enabled: false
671
- description: 'Generating tags file from source'
686
+ description: 'Generate tags file from source'
672
687
  quiet: true
673
688
  required_executable: 'ctags'
674
689
 
675
690
  NpmInstall:
676
691
  enabled: false
677
- description: 'Installing NPM dependencies'
692
+ description: 'Install NPM dependencies'
678
693
  requires_files: true
679
694
  required_executable: 'npm'
680
695
  flags: ['install']
@@ -684,7 +699,7 @@ PostCommit:
684
699
 
685
700
  SubmoduleStatus:
686
701
  enabled: false
687
- description: 'Checking submodule status'
702
+ description: 'Check submodule status'
688
703
  quiet: true
689
704
  recursive: false
690
705
 
@@ -696,7 +711,7 @@ PostMerge:
696
711
 
697
712
  BowerInstall:
698
713
  enabled: false
699
- description: 'Installing bower dependencies'
714
+ description: 'Install bower dependencies'
700
715
  requires_files: true
701
716
  required_executable: 'bower'
702
717
  install_command: 'npm install -g bower'
@@ -705,7 +720,7 @@ PostMerge:
705
720
 
706
721
  BundleInstall:
707
722
  enabled: false
708
- description: 'Installing Bundler dependencies'
723
+ description: 'Install Bundler dependencies'
709
724
  requires_files: true
710
725
  required_executable: 'bundle'
711
726
  install_command: 'gem install bundler'
@@ -717,13 +732,13 @@ PostMerge:
717
732
 
718
733
  IndexTags:
719
734
  enabled: false
720
- description: 'Generating tags file from source'
735
+ description: 'Generate tags file from source'
721
736
  quiet: true
722
737
  required_executable: 'ctags'
723
738
 
724
739
  NpmInstall:
725
740
  enabled: false
726
- description: 'Installing NPM dependencies'
741
+ description: 'Install NPM dependencies'
727
742
  requires_files: true
728
743
  required_executable: 'npm'
729
744
  flags: ['install']
@@ -733,7 +748,7 @@ PostMerge:
733
748
 
734
749
  SubmoduleStatus:
735
750
  enabled: false
736
- description: 'Checking submodule status'
751
+ description: 'Check submodule status'
737
752
  quiet: true
738
753
  recursive: false
739
754
 
@@ -745,7 +760,7 @@ PostRewrite:
745
760
 
746
761
  BowerInstall:
747
762
  enabled: false
748
- description: 'Installing bower dependencies'
763
+ description: 'Install bower dependencies'
749
764
  requires_files: true
750
765
  required_executable: 'bower'
751
766
  install_command: 'npm install -g bower'
@@ -754,7 +769,7 @@ PostRewrite:
754
769
 
755
770
  BundleInstall:
756
771
  enabled: false
757
- description: 'Installing Bundler dependencies'
772
+ description: 'Install Bundler dependencies'
758
773
  requires_files: true
759
774
  required_executable: 'bundle'
760
775
  install_command: 'gem install bundler'
@@ -766,13 +781,13 @@ PostRewrite:
766
781
 
767
782
  IndexTags:
768
783
  enabled: false
769
- description: 'Generating tags file from source'
784
+ description: 'Generate tags file from source'
770
785
  quiet: true
771
786
  required_executable: 'ctags'
772
787
 
773
788
  NpmInstall:
774
789
  enabled: false
775
- description: 'Installing NPM dependencies'
790
+ description: 'Install NPM dependencies'
776
791
  requires_files: true
777
792
  required_executable: 'npm'
778
793
  flags: ['install']
@@ -782,7 +797,7 @@ PostRewrite:
782
797
 
783
798
  SubmoduleStatus:
784
799
  enabled: false
785
- description: 'Checking submodule status'
800
+ description: 'Check submodule status'
786
801
  quiet: true
787
802
  recursive: false
788
803
 
@@ -796,19 +811,19 @@ PrePush:
796
811
 
797
812
  ProtectedBranches:
798
813
  enabled: false
799
- description: 'Checking for illegal pushes to protected branches'
814
+ description: 'Check for illegal pushes to protected branches'
800
815
  branches: ['master']
801
816
 
802
817
  RSpec:
803
818
  enabled: false
804
- description: 'Running RSpec test suite'
819
+ description: 'Run RSpec test suite'
805
820
  required_executable: 'rspec'
806
821
 
807
822
  Minitest:
808
823
  enabled: false
809
- description: 'Running Minitest test suite'
810
- command: ['ruby', '-Ilib:test', 'test']
811
- required_library: 'minitest'
824
+ description: 'Run Minitest test suite'
825
+ command: ['ruby', '-Ilib:test', '-rminitest', "-e 'exit! Minitest.run'"]
826
+ include: 'test/**/*_test.rb'
812
827
 
813
828
  # Hooks that run during `git rebase`, before any commits are rebased.
814
829
  # If a hook fails, the rebase is aborted.
@@ -820,5 +835,5 @@ PreRebase:
820
835
 
821
836
  MergedCommits:
822
837
  enabled: false
823
- description: 'Checking for commits that have already been merged'
838
+ description: 'Check for commits that have already been merged'
824
839
  branches: ['master']
@@ -42,6 +42,9 @@ module Overcommit::Exceptions
42
42
  # Raised when one or more hook plugin signatures have changed.
43
43
  class InvalidHookSignature < StandardError; end
44
44
 
45
+ # Raised when there is a problem processing output into {Hook::Messages}s.
46
+ class MessageProcessingError < StandardError; end
47
+
45
48
  # Raised when an installation target already contains non-Overcommit hooks.
46
49
  class PreExistingHooks < StandardError; end
47
50
  end
@@ -266,5 +266,11 @@ module Overcommit
266
266
  split(/\s+/).
267
267
  reject { |s| s.empty? || s == '*' }
268
268
  end
269
+
270
+ # Returns the name of the currently checked out branch.
271
+ # @return [String]
272
+ def current_branch
273
+ `git symbolic-ref --short -q HEAD`.chomp
274
+ end
269
275
  end
270
276
  end
@@ -17,7 +17,7 @@ module Overcommit::Hook
17
17
  class Base # rubocop:disable Metrics/ClassLength
18
18
  extend Forwardable
19
19
 
20
- def_delegators :@context, :modified_files
20
+ def_delegators :@context, :all_files, :modified_files
21
21
  attr_reader :config
22
22
 
23
23
  # @param config [Overcommit::Configuration]
@@ -54,7 +54,7 @@ module Overcommit::Hook
54
54
  end
55
55
 
56
56
  def description
57
- @config['description'] || "Running #{name}"
57
+ @config['description'] || "Run #{name}"
58
58
  end
59
59
 
60
60
  def required?
@@ -155,11 +155,21 @@ module Overcommit::Hook
155
155
  # Gets a list of staged files that apply to this hook based on its
156
156
  # configured `include` and `exclude` lists.
157
157
  def applicable_files
158
- @applicable_files ||= modified_files.select { |file| applicable_file?(file) }.sort
158
+ @applicable_files ||= select_applicable(modified_files)
159
+ end
160
+
161
+ # Gets a list of all files that apply to this hook based on its
162
+ # configured `include` and `exclude` lists.
163
+ def included_files
164
+ @included_files ||= select_applicable(all_files)
159
165
  end
160
166
 
161
167
  private
162
168
 
169
+ def select_applicable(list)
170
+ list.select { |file| applicable_file?(file) }.sort
171
+ end
172
+
163
173
  def applicable_file?(file)
164
174
  includes = Array(@config['include']).flatten.map do |glob|
165
175
  Overcommit::Utils.convert_glob_to_absolute(glob)
@@ -0,0 +1,27 @@
1
+ module Overcommit::Hook::CommitMsg
2
+ # Ensures the commit message follows a specific format.
3
+ class MessageFormat < Base
4
+ def run
5
+ error_msg = validate_pattern(commit_message_lines.join("\n"))
6
+ return :fail, error_msg if error_msg
7
+
8
+ :pass
9
+ end
10
+
11
+ private
12
+
13
+ def validate_pattern(message)
14
+ pattern = config['pattern']
15
+ return if pattern.empty?
16
+
17
+ expected_pattern_message = config['expected_pattern_message']
18
+ sample_message = config['sample_message']
19
+
20
+ [
21
+ 'Commit message pattern mismatch.',
22
+ "Expected : #{expected_pattern_message}",
23
+ "Sample : #{sample_message}"
24
+ ].join("\n") unless message =~ /#{pattern}/
25
+ end
26
+ end
27
+ end
@@ -22,13 +22,16 @@ module Overcommit::Hook::PreCommit
22
22
  # @param type_categorizer [Proc] function executed against the `type`
23
23
  # capture group to convert it to a `:warning` or `:error` symbol. Assumes
24
24
  # `:error` if `nil`.
25
- # @raise [RuntimeError] line of output did not match regex
25
+ # @raise [Overcommit::Exceptions::MessageProcessingError] line of output did
26
+ # not match regex
26
27
  # @return [Array<Message>]
27
28
  def extract_messages(output_messages, regex, type_categorizer = nil)
28
- output_messages.map do |message|
29
+ output_messages.map.with_index do |message, index|
29
30
  unless match = message.match(regex)
30
- raise 'Unexpected output: unable to determine line number or type ' \
31
- "of error/warning for message '#{message}'"
31
+ raise Overcommit::Exceptions::MessageProcessingError,
32
+ 'Unexpected output: unable to determine line number or type ' \
33
+ "of error/warning for output:\n" \
34
+ "#{output_messages[index..-1].join("\n")}"
32
35
  end
33
36
 
34
37
  file = extract_file(match, message)
@@ -43,7 +46,8 @@ module Overcommit::Hook::PreCommit
43
46
  return unless match.names.include?('file')
44
47
 
45
48
  if match[:file].to_s.empty?
46
- raise "Unexpected output: no file found in '#{message}'"
49
+ raise Overcommit::Exceptions::MessageProcessingError,
50
+ "Unexpected output: no file found in '#{message}'"
47
51
  end
48
52
 
49
53
  match[:file]
@@ -53,7 +57,8 @@ module Overcommit::Hook::PreCommit
53
57
  return unless match.names.include?('line')
54
58
  Integer(match[:line])
55
59
  rescue ArgumentError, TypeError
56
- raise "Unexpected output: invalid line number found in '#{message}'"
60
+ raise Overcommit::Exceptions::MessageProcessingError,
61
+ "Unexpected output: invalid line number found in '#{message}'"
57
62
  end
58
63
 
59
64
  def extract_type(match, message, type_categorizer)
@@ -61,7 +66,8 @@ module Overcommit::Hook::PreCommit
61
66
  type_match = match.names.include?('type') ? match[:type] : nil
62
67
  type = type_categorizer.call(type_match)
63
68
  unless Overcommit::Hook::MESSAGE_TYPES.include?(type)
64
- raise "Invalid message type '#{type}' for '#{message}': must " \
69
+ raise Overcommit::Exceptions::MessageProcessingError,
70
+ "Invalid message type '#{type}' for '#{message}': must " \
65
71
  "be one of #{Overcommit::Hook::MESSAGE_TYPES.inspect}"
66
72
  end
67
73
  type
@@ -1,6 +1,16 @@
1
1
  module Overcommit::Hook::PreCommit
2
2
  # Runs `eslint` against any modified JavaScript files.
3
3
  #
4
+ # Protip: if you have an npm script set up to run eslint, you can configure
5
+ # this hook to run eslint via your npm script by using the `command` option in
6
+ # your .overcommit.yml file. This can be useful if you have some eslint
7
+ # configuration built into your npm script that you don't want to repeat
8
+ # somewhere else. Example:
9
+ #
10
+ # EsLint:
11
+ # enabled: true
12
+ # command: ['npm', 'run', 'lint']
13
+ #
4
14
  # @see http://eslint.org/
5
15
  class EsLint < Base
6
16
  def run
@@ -2,6 +2,16 @@ module Overcommit::Hook::PreCommit
2
2
  # Checks for files with execute permissions, which are usually not necessary
3
3
  # in source code files (and are typically caused by a misconfigured editor
4
4
  # assigning incorrect default permissions).
5
+ #
6
+ # Protip: if you have some files that you want to allow execute permissions
7
+ # on, you can disable this hook for those files by using the `exclude` option
8
+ # on your .overcommit.yml file. Example:
9
+ #
10
+ # ExecutePermissions:
11
+ # enabled: true
12
+ # exclude:
13
+ # - 'path/to/my/file/that/should/have/execute/permissions.sh'
14
+ # - 'directory/that/should/have/execute/permissions/**/*'
5
15
  class ExecutePermissions < Base
6
16
  def run
7
17
  file_modes = {}
@@ -0,0 +1,24 @@
1
+ module Overcommit::Hook::PreCommit
2
+ # Prevents commits to branches matching one of the configured patterns.
3
+ class ForbiddenBranches < Base
4
+ def run
5
+ return :pass unless forbidden_commit?
6
+
7
+ [:fail, "Committing to #{current_branch} is forbidden"]
8
+ end
9
+
10
+ private
11
+
12
+ def forbidden_commit?
13
+ forbidden_branch_patterns.any? { |p| File.fnmatch(p, current_branch) }
14
+ end
15
+
16
+ def forbidden_branch_patterns
17
+ @forbidden_branch_patterns ||= Array(config['branch_patterns'])
18
+ end
19
+
20
+ def current_branch
21
+ @current_branch ||= Overcommit::GitRepo.current_branch
22
+ end
23
+ end
24
+ end
@@ -3,10 +3,6 @@ module Overcommit::Hook::PreCommit
3
3
  #
4
4
  # @see https://github.com/brigade/scss-lint
5
5
  class ScssLint < Base
6
- MESSAGE_TYPE_CATEGORIZER = lambda do |type|
7
- type.include?('W') ? :warning : :error
8
- end
9
-
10
6
  def run
11
7
  result = execute(command, args: applicable_files)
12
8
 
@@ -16,13 +12,30 @@ module Overcommit::Hook::PreCommit
16
12
  return :pass if [0, 81].include?(result.status)
17
13
 
18
14
  # Any status that isn't indicating lint warnings or errors indicates failure
19
- return :fail, result.stdout unless [1, 2].include?(result.status)
15
+ return :fail, (result.stdout + result.stderr) unless [1, 2].include?(result.status)
16
+
17
+ begin
18
+ collect_lint_messages(JSON.parse(result.stdout))
19
+ rescue JSON::ParserError => ex
20
+ return :fail, "Unable to parse JSON returned by SCSS-Lint: #{ex.message}\n" \
21
+ "STDOUT: #{result.stdout}\nSTDERR: #{result.stderr}"
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def collect_lint_messages(files_to_lints)
28
+ files_to_lints.flat_map do |path, lints|
29
+ lints.map do |lint|
30
+ severity = lint['severity'] == 'warning' ? :warning : :error
31
+
32
+ message = lint['reason']
33
+ message = "#{lint['linter']}: #{message}" if lint['linter']
34
+ message = "#{path}:#{lint['line']} #{message}"
20
35
 
21
- extract_messages(
22
- result.stdout.split("\n"),
23
- /^(?<file>(?:\w:)?[^:]+):(?<line>\d+)[^ ]* (?<type>[^ ]+)/,
24
- MESSAGE_TYPE_CATEGORIZER,
25
- )
36
+ Overcommit::Hook::Message.new(severity, path, lint['line'], message)
37
+ end
38
+ end
26
39
  end
27
40
  end
28
41
  end
@@ -10,5 +10,9 @@ module Overcommit::Hook::PrePush
10
10
  output = result.stdout + result.stderr
11
11
  [:fail, output]
12
12
  end
13
+
14
+ def command
15
+ super + included_files.map { |file| "-r#{file}" }
16
+ end
13
17
  end
14
18
  end
@@ -79,6 +79,13 @@ module Overcommit::HookContext
79
79
  []
80
80
  end
81
81
 
82
+ # Returns the full list of files tracked by git
83
+ #
84
+ # @return [Array<String>]
85
+ def all_files
86
+ Overcommit::GitRepo.all_files
87
+ end
88
+
82
89
  # Returns the contents of the entire standard input stream that were passed
83
90
  # to the hook.
84
91
  #
@@ -15,6 +15,13 @@ module Overcommit::HookContext
15
15
  cmd = Overcommit::Utils.parent_command
16
16
  amend_pattern = 'commit(\s.*)?\s--amend(\s|$)'
17
17
 
18
+ # Since the ps command can return invalid byte sequences for commands
19
+ # containing unicode characters, we replace the offending characters,
20
+ # since the pattern we're looking for will consist of ASCII characters
21
+ unless cmd.valid_encoding?
22
+ cmd.encode!('UTF-16be', invalid: :replace, replace: '?').encode!('UTF-8')
23
+ end
24
+
18
25
  return @amendment if
19
26
  # True if the command is a commit with the --amend flag
20
27
  @amendment = !(/\s#{amend_pattern}/ =~ cmd).nil?
@@ -7,7 +7,7 @@ module Overcommit::HookContext
7
7
  # which is useful for automated CI scripts.
8
8
  class RunAll < Base
9
9
  def modified_files
10
- @modified_files ||= Overcommit::GitRepo.all_files
10
+ @modified_files ||= all_files
11
11
  end
12
12
 
13
13
  # Returns all lines in the file since in this context the entire repo is
@@ -150,6 +150,9 @@ module Overcommit
150
150
  return if should_skip?(hook)
151
151
 
152
152
  status, output = hook.run_and_transform
153
+ rescue Overcommit::Exceptions::MessageProcessingError => ex
154
+ status = :fail
155
+ output = ex.message
153
156
  rescue => ex
154
157
  status = :fail
155
158
  output = "Hook raised unexpected error\n#{ex.message}\n#{ex.backtrace.join("\n")}"
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module Overcommit
5
- VERSION = '0.32.0.rc1'.freeze
5
+ VERSION = '0.32.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.32.0.rc1
4
+ version: 0.32.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: 2016-01-29 00:00:00.000000000 Z
12
+ date: 2016-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: childprocess
@@ -110,6 +110,7 @@ files:
110
110
  - lib/overcommit/hook/commit_msg/empty_message.rb
111
111
  - lib/overcommit/hook/commit_msg/gerrit_change_id.rb
112
112
  - lib/overcommit/hook/commit_msg/hard_tabs.rb
113
+ - lib/overcommit/hook/commit_msg/message_format.rb
113
114
  - lib/overcommit/hook/commit_msg/russian_novel.rb
114
115
  - lib/overcommit/hook/commit_msg/single_line_subject.rb
115
116
  - lib/overcommit/hook/commit_msg/spell_check.rb
@@ -154,6 +155,7 @@ files:
154
155
  - lib/overcommit/hook/pre_commit/dogma.rb
155
156
  - lib/overcommit/hook/pre_commit/es_lint.rb
156
157
  - lib/overcommit/hook/pre_commit/execute_permissions.rb
158
+ - lib/overcommit/hook/pre_commit/forbidden_branches.rb
157
159
  - lib/overcommit/hook/pre_commit/go_lint.rb
158
160
  - lib/overcommit/hook/pre_commit/go_vet.rb
159
161
  - lib/overcommit/hook/pre_commit/haml_lint.rb
@@ -263,9 +265,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
263
265
  version: 1.9.3
264
266
  required_rubygems_version: !ruby/object:Gem::Requirement
265
267
  requirements:
266
- - - ">"
268
+ - - ">="
267
269
  - !ruby/object:Gem::Version
268
- version: 1.3.1
270
+ version: '0'
269
271
  requirements: []
270
272
  rubyforge_project:
271
273
  rubygems_version: 2.4.5.1