overcommit 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/bin/overcommit +0 -1
  3. data/config/default.yml +155 -2
  4. data/lib/overcommit.rb +2 -0
  5. data/lib/overcommit/cli.rb +1 -0
  6. data/lib/overcommit/configuration.rb +1 -1
  7. data/lib/overcommit/git_repo.rb +1 -2
  8. data/lib/overcommit/hook/base.rb +1 -1
  9. data/lib/overcommit/hook/commit_msg/gerrit_change_id.rb +1 -1
  10. data/lib/overcommit/hook/post_checkout/bower_install.rb +11 -0
  11. data/lib/overcommit/hook/post_checkout/bundle_install.rb +11 -0
  12. data/lib/overcommit/hook/post_checkout/npm_install.rb +11 -0
  13. data/lib/overcommit/hook/post_commit/bower_install.rb +11 -0
  14. data/lib/overcommit/hook/post_commit/bundle_install.rb +11 -0
  15. data/lib/overcommit/hook/post_commit/npm_install.rb +11 -0
  16. data/lib/overcommit/hook/post_merge/bower_install.rb +11 -0
  17. data/lib/overcommit/hook/post_merge/bundle_install.rb +11 -0
  18. data/lib/overcommit/hook/post_merge/npm_install.rb +11 -0
  19. data/lib/overcommit/hook/post_rewrite/bower_install.rb +11 -0
  20. data/lib/overcommit/hook/post_rewrite/bundle_install.rb +11 -0
  21. data/lib/overcommit/hook/post_rewrite/npm_install.rb +11 -0
  22. data/lib/overcommit/hook/pre_commit/base.rb +1 -1
  23. data/lib/overcommit/hook/pre_commit/chamber_security.rb +1 -1
  24. data/lib/overcommit/hook/pre_commit/coffee_lint.rb +19 -27
  25. data/lib/overcommit/hook/pre_commit/css_lint.rb +2 -2
  26. data/lib/overcommit/hook/pre_commit/es_lint.rb +2 -2
  27. data/lib/overcommit/hook/pre_commit/execute_permissions.rb +64 -0
  28. data/lib/overcommit/hook/pre_commit/go_lint.rb +2 -2
  29. data/lib/overcommit/hook/pre_commit/go_vet.rb +2 -2
  30. data/lib/overcommit/hook/pre_commit/haml_lint.rb +2 -2
  31. data/lib/overcommit/hook/pre_commit/hard_tabs.rb +1 -1
  32. data/lib/overcommit/hook/pre_commit/hlint.rb +32 -0
  33. data/lib/overcommit/hook/pre_commit/html_hint.rb +1 -1
  34. data/lib/overcommit/hook/pre_commit/html_tidy.rb +1 -1
  35. data/lib/overcommit/hook/pre_commit/image_optim.rb +1 -1
  36. data/lib/overcommit/hook/pre_commit/java_checkstyle.rb +2 -2
  37. data/lib/overcommit/hook/pre_commit/js_hint.rb +2 -2
  38. data/lib/overcommit/hook/pre_commit/js_lint.rb +2 -2
  39. data/lib/overcommit/hook/pre_commit/jscs.rb +2 -2
  40. data/lib/overcommit/hook/pre_commit/jsl.rb +1 -1
  41. data/lib/overcommit/hook/pre_commit/pep257.rb +2 -2
  42. data/lib/overcommit/hook/pre_commit/pep8.rb +2 -2
  43. data/lib/overcommit/hook/pre_commit/puppet_lint.rb +24 -0
  44. data/lib/overcommit/hook/pre_commit/pyflakes.rb +2 -2
  45. data/lib/overcommit/hook/pre_commit/pylint.rb +2 -2
  46. data/lib/overcommit/hook/pre_commit/python_flake8.rb +2 -2
  47. data/lib/overcommit/hook/pre_commit/reek.rb +2 -2
  48. data/lib/overcommit/hook/pre_commit/rubo_cop.rb +2 -2
  49. data/lib/overcommit/hook/pre_commit/ruby_lint.rb +2 -2
  50. data/lib/overcommit/hook/pre_commit/scalariform.rb +2 -2
  51. data/lib/overcommit/hook/pre_commit/scalastyle.rb +2 -2
  52. data/lib/overcommit/hook/pre_commit/scss_lint.rb +2 -2
  53. data/lib/overcommit/hook/pre_commit/semi_standard.rb +5 -3
  54. data/lib/overcommit/hook/pre_commit/shell_check.rb +2 -2
  55. data/lib/overcommit/hook/pre_commit/slim_lint.rb +2 -2
  56. data/lib/overcommit/hook/pre_commit/sqlint.rb +24 -0
  57. data/lib/overcommit/hook/pre_commit/standard.rb +5 -3
  58. data/lib/overcommit/hook/pre_commit/trailing_whitespace.rb +1 -1
  59. data/lib/overcommit/hook/pre_commit/travis_lint.rb +1 -1
  60. data/lib/overcommit/hook/pre_commit/vint.rb +2 -2
  61. data/lib/overcommit/hook/pre_commit/xml_lint.rb +2 -2
  62. data/lib/overcommit/hook/shared/bower_install.rb +13 -0
  63. data/lib/overcommit/hook/shared/bundle_install.rb +13 -0
  64. data/lib/overcommit/hook/shared/npm_install.rb +13 -0
  65. data/lib/overcommit/hook_context/base.rb +2 -2
  66. data/lib/overcommit/hook_context/pre_commit.rb +1 -1
  67. data/lib/overcommit/hook_context/run_all.rb +5 -0
  68. data/lib/overcommit/hook_signer.rb +2 -1
  69. data/lib/overcommit/installer.rb +4 -2
  70. data/lib/overcommit/os.rb +34 -0
  71. data/lib/overcommit/printer.rb +1 -1
  72. data/lib/overcommit/subprocess.rb +19 -1
  73. data/lib/overcommit/utils.rb +17 -5
  74. data/lib/overcommit/utils/file_utils.rb +69 -0
  75. data/lib/overcommit/version.rb +1 -1
  76. data/template-dir/hooks/commit-msg +2 -0
  77. data/template-dir/hooks/overcommit-hook +2 -0
  78. data/template-dir/hooks/post-checkout +2 -0
  79. data/template-dir/hooks/post-commit +2 -0
  80. data/template-dir/hooks/post-merge +2 -0
  81. data/template-dir/hooks/post-rewrite +2 -0
  82. data/template-dir/hooks/pre-commit +2 -0
  83. data/template-dir/hooks/pre-push +2 -0
  84. data/template-dir/hooks/pre-rebase +2 -0
  85. metadata +23 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b15d613ceeafdf7cf3c762c611b309b596bf9fd9
4
- data.tar.gz: 89d01be1ecf271fc7f8f6b6472fb6e056e8980c7
3
+ metadata.gz: 74c5fbc6dd718ba856a0c0ad6255f9e6e0d6f72c
4
+ data.tar.gz: 9b40e46e88199c43d8c708202b872ea5ce1b52fc
5
5
  SHA512:
6
- metadata.gz: 5a665c68e8e3066f1f4f2b62997474b20f910360a7aadf2b24d5c2caad64260a3c2f485ffbd9174b7681fbd24a743a07a97820a2c4fed38e5d54c00c95ceccd8
7
- data.tar.gz: a570dcdcf2ac15e352f837ebb404819f197d74428881586f2c2eec1f6a4f4eebfbf5e4c80536cb38fe2a6ca941b5de129357ae0437c8b739a747738a4f2d1baf
6
+ metadata.gz: 278cfa2c64204a0bfe3b9c5e0dfae81396ec1317fadaa1fb4364bf979795c642e47c39c16b2ba64dc2602f1377aeb3073011c67ab091540cc7027e931f3500bc
7
+ data.tar.gz: b9908d3670f23dcc0c4766da676e44642eb5f211147de22801690c7ad679ba589d9f8b5f14210dc2a6ad65a06fc6ecb82807e2517efafbacf5443a550963d91b
data/bin/overcommit CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'overcommit'
4
3
  require 'overcommit/cli'
5
4
 
6
5
  logger = Overcommit::Logger.new(STDOUT)
data/config/default.yml CHANGED
@@ -176,8 +176,7 @@ PreCommit:
176
176
  enabled: false
177
177
  description: 'Analyzing with coffeelint'
178
178
  required_executable: 'coffeelint'
179
- required_library: 'json'
180
- flags: ['--reporter=raw']
179
+ flags: ['--reporter=csv']
181
180
  install_command: 'npm install -g coffeelint'
182
181
  include: '**/*.coffee'
183
182
 
@@ -197,6 +196,11 @@ PreCommit:
197
196
  install_command: 'npm install -g eslint'
198
197
  include: '**/*.js'
199
198
 
199
+ ExecutePermissions:
200
+ enabled: false
201
+ description: 'Checking for file execute permissions'
202
+ quiet: true
203
+
200
204
  GoLint:
201
205
  enabled: false
202
206
  description: 'Analyzing with golint'
@@ -226,6 +230,13 @@ PreCommit:
226
230
  required_executable: 'grep'
227
231
  flags: ['-IHn', "\t"]
228
232
 
233
+ Hlint:
234
+ enabled: false
235
+ description: 'Analyzing with hlint'
236
+ required_executable: 'hlint'
237
+ install_command: 'cabal install hlint'
238
+ include: '**/*.hs'
239
+
229
240
  HtmlHint:
230
241
  enabled: false
231
242
  description: 'Analyzing with HTMLHint'
@@ -325,6 +336,17 @@ PreCommit:
325
336
  install_command: 'pip install pep8'
326
337
  include: '**/*.py'
327
338
 
339
+ PuppetLint:
340
+ enabled: false
341
+ description: 'Analyzing with puppet-lint'
342
+ required_executable: 'puppet-lint'
343
+ install_command: 'gem install puppet-lint'
344
+ flags:
345
+ - '--log-format="%{fullpath}:%{line}:%{column}:%{KIND}: %{message} (%{check})"'
346
+ - '--fail-on-warnings'
347
+ - '--error-level=all'
348
+ include: '**/*.pp'
349
+
328
350
  Pyflakes:
329
351
  enabled: false
330
352
  description: 'Analyzing with pyflakes'
@@ -436,6 +458,13 @@ PreCommit:
436
458
  install_command: 'gem install slim_lint'
437
459
  include: '**/*.slim'
438
460
 
461
+ Sqlint:
462
+ enabled: false
463
+ description: 'Analyzing with sqlint'
464
+ required_executable: 'sqlint'
465
+ install_command: 'gem install sqlint'
466
+ include: '**/*.sql'
467
+
439
468
  Standard:
440
469
  enabled: false
441
470
  description: 'Analyzing with standard'
@@ -521,12 +550,43 @@ PostCheckout:
521
550
  required: false
522
551
  quiet: false
523
552
 
553
+ BowerInstall:
554
+ enabled: false
555
+ description: 'Installing bower dependencies'
556
+ requires_files: true
557
+ required_executable: 'bower'
558
+ install_command: 'npm install -g bower'
559
+ flags: ['install']
560
+ include: 'bower.json'
561
+
562
+ BundleInstall:
563
+ enabled: false
564
+ description: 'Installing Bundler dependencies'
565
+ requires_files: true
566
+ required_executable: 'bundle'
567
+ install_command: 'gem install bundler'
568
+ flags: ['install']
569
+ include:
570
+ - 'Gemfile'
571
+ - 'Gemfile.lock'
572
+ - '*.gemspec'
573
+
524
574
  IndexTags:
525
575
  enabled: false
526
576
  description: 'Generating tags file from source'
527
577
  quiet: true
528
578
  required_executable: 'ctags'
529
579
 
580
+ NpmInstall:
581
+ enabled: false
582
+ description: 'Installing NPM dependencies'
583
+ requires_files: true
584
+ required_executable: 'npm'
585
+ flags: ['install']
586
+ include:
587
+ - 'package.json'
588
+ - 'npm-shrinkwrap.json'
589
+
530
590
  SubmoduleStatus:
531
591
  enabled: false
532
592
  description: 'Checking submodule status'
@@ -540,6 +600,27 @@ PostCommit:
540
600
  required: false
541
601
  quiet: false
542
602
 
603
+ BowerInstall:
604
+ enabled: false
605
+ description: 'Installing bower dependencies'
606
+ requires_files: true
607
+ required_executable: 'bower'
608
+ install_command: 'npm install -g bower'
609
+ flags: ['install']
610
+ include: 'bower.json'
611
+
612
+ BundleInstall:
613
+ enabled: false
614
+ description: 'Installing Bundler dependencies'
615
+ requires_files: true
616
+ required_executable: 'bundle'
617
+ install_command: 'gem install bundler'
618
+ flags: ['install']
619
+ include:
620
+ - 'Gemfile'
621
+ - 'Gemfile.lock'
622
+ - '*.gemspec'
623
+
543
624
  GitGuilt:
544
625
  enabled: false
545
626
  description: 'Calculating changes in blame since last commit'
@@ -554,6 +635,16 @@ PostCommit:
554
635
  quiet: true
555
636
  required_executable: 'ctags'
556
637
 
638
+ NpmInstall:
639
+ enabled: false
640
+ description: 'Installing NPM dependencies'
641
+ requires_files: true
642
+ required_executable: 'npm'
643
+ flags: ['install']
644
+ include:
645
+ - 'package.json'
646
+ - 'npm-shrinkwrap.json'
647
+
557
648
  SubmoduleStatus:
558
649
  enabled: false
559
650
  description: 'Checking submodule status'
@@ -566,12 +657,43 @@ PostMerge:
566
657
  requires_files: false
567
658
  quiet: false
568
659
 
660
+ BowerInstall:
661
+ enabled: false
662
+ description: 'Installing bower dependencies'
663
+ requires_files: true
664
+ required_executable: 'bower'
665
+ install_command: 'npm install -g bower'
666
+ flags: ['install']
667
+ include: 'bower.json'
668
+
669
+ BundleInstall:
670
+ enabled: false
671
+ description: 'Installing Bundler dependencies'
672
+ requires_files: true
673
+ required_executable: 'bundle'
674
+ install_command: 'gem install bundler'
675
+ flags: ['install']
676
+ include:
677
+ - 'Gemfile'
678
+ - 'Gemfile.lock'
679
+ - '*.gemspec'
680
+
569
681
  IndexTags:
570
682
  enabled: false
571
683
  description: 'Generating tags file from source'
572
684
  quiet: true
573
685
  required_executable: 'ctags'
574
686
 
687
+ NpmInstall:
688
+ enabled: false
689
+ description: 'Installing NPM dependencies'
690
+ requires_files: true
691
+ required_executable: 'npm'
692
+ flags: ['install']
693
+ include:
694
+ - 'package.json'
695
+ - 'npm-shrinkwrap.json'
696
+
575
697
  SubmoduleStatus:
576
698
  enabled: false
577
699
  description: 'Checking submodule status'
@@ -584,12 +706,43 @@ PostRewrite:
584
706
  requires_files: false
585
707
  quiet: false
586
708
 
709
+ BowerInstall:
710
+ enabled: false
711
+ description: 'Installing bower dependencies'
712
+ requires_files: true
713
+ required_executable: 'bower'
714
+ install_command: 'npm install -g bower'
715
+ flags: ['install']
716
+ include: 'bower.json'
717
+
718
+ BundleInstall:
719
+ enabled: false
720
+ description: 'Installing Bundler dependencies'
721
+ requires_files: true
722
+ required_executable: 'bundle'
723
+ install_command: 'gem install bundler'
724
+ flags: ['install']
725
+ include:
726
+ - 'Gemfile'
727
+ - 'Gemfile.lock'
728
+ - '*.gemspec'
729
+
587
730
  IndexTags:
588
731
  enabled: false
589
732
  description: 'Generating tags file from source'
590
733
  quiet: true
591
734
  required_executable: 'ctags'
592
735
 
736
+ NpmInstall:
737
+ enabled: false
738
+ description: 'Installing NPM dependencies'
739
+ requires_files: true
740
+ required_executable: 'npm'
741
+ flags: ['install']
742
+ include:
743
+ - 'package.json'
744
+ - 'npm-shrinkwrap.json'
745
+
593
746
  SubmoduleStatus:
594
747
  enabled: false
595
748
  description: 'Checking submodule status'
data/lib/overcommit.rb CHANGED
@@ -1,5 +1,7 @@
1
+ require 'overcommit/os'
1
2
  require 'overcommit/constants'
2
3
  require 'overcommit/exceptions'
4
+ require 'overcommit/utils/file_utils'
3
5
  require 'overcommit/utils'
4
6
  require 'overcommit/git_version'
5
7
  require 'overcommit/configuration_validator'
@@ -1,3 +1,4 @@
1
+ require 'overcommit'
1
2
  require 'optparse'
2
3
 
3
4
  module Overcommit
@@ -71,7 +71,7 @@ module Overcommit
71
71
  Overcommit::Utils.supported_hook_types.each do |hook_type|
72
72
  hook_type_class_name = Overcommit::Utils.camel_case(hook_type)
73
73
 
74
- directory = File.join(plugin_directory, hook_type.gsub('-', '_'))
74
+ directory = File.join(plugin_directory, hook_type.tr('-', '_'))
75
75
  plugin_paths = Dir[File.join(directory, '*.rb')].sort
76
76
 
77
77
  hook_names = plugin_paths.map do |path|
@@ -83,8 +83,7 @@ module Overcommit
83
83
  lines
84
84
  end
85
85
 
86
- # Returns the names of all files that have been modified from compared to
87
- # HEAD.
86
+ # Returns the names of all files that have been modified compared to HEAD.
88
87
  #
89
88
  # @param options [Hash]
90
89
  # @return [Array<String>] list of absolute file paths
@@ -147,7 +147,7 @@ module Overcommit::Hook
147
147
  # Gets a list of staged files that apply to this hook based on its
148
148
  # configured `include` and `exclude` lists.
149
149
  def applicable_files
150
- @applicable_files ||= modified_files.select { |file| applicable_file?(file) }
150
+ @applicable_files ||= modified_files.select { |file| applicable_file?(file) }.sort
151
151
  end
152
152
 
153
153
  private
@@ -11,7 +11,7 @@ module Overcommit::Hook::CommitMsg
11
11
  SCRIPT_LOCATION = Overcommit::Utils.script_path('gerrit-change-id')
12
12
 
13
13
  def run
14
- result = execute([SCRIPT_LOCATION, commit_message_file])
14
+ result = execute(['sh', SCRIPT_LOCATION, commit_message_file])
15
15
  return :pass if result.success?
16
16
 
17
17
  [:fail, result.stdout]
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/bower_install'
2
+
3
+ module Overcommit::Hook::PostCheckout
4
+ # Runs `bower install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BowerInstall}
8
+ class BowerInstall < Base
9
+ include Overcommit::Hook::Shared::BowerInstall
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/bundle_install'
2
+
3
+ module Overcommit::Hook::PostCheckout
4
+ # Runs `bundle install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BundleInstall}
8
+ class BundleInstall < Base
9
+ include Overcommit::Hook::Shared::BundleInstall
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/npm_install'
2
+
3
+ module Overcommit::Hook::PostCheckout
4
+ # Runs `npm install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::NpmInstall}
8
+ class NpmInstall < Base
9
+ include Overcommit::Hook::Shared::NpmInstall
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/bower_install'
2
+
3
+ module Overcommit::Hook::PostCommit
4
+ # Runs `bower install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BowerInstall}
8
+ class BowerInstall < Base
9
+ include Overcommit::Hook::Shared::BowerInstall
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/bundle_install'
2
+
3
+ module Overcommit::Hook::PostCommit
4
+ # Runs `bundle install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BundleInstall}
8
+ class BundleInstall < Base
9
+ include Overcommit::Hook::Shared::BundleInstall
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/npm_install'
2
+
3
+ module Overcommit::Hook::PostCommit
4
+ # Runs `npm install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::NpmInstall}
8
+ class NpmInstall < Base
9
+ include Overcommit::Hook::Shared::NpmInstall
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/bower_install'
2
+
3
+ module Overcommit::Hook::PostMerge
4
+ # Runs `bower install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BowerInstall}
8
+ class BowerInstall < Base
9
+ include Overcommit::Hook::Shared::BowerInstall
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/bundle_install'
2
+
3
+ module Overcommit::Hook::PostMerge
4
+ # Runs `bundle install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BundleInstall}
8
+ class BundleInstall < Base
9
+ include Overcommit::Hook::Shared::BundleInstall
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/npm_install'
2
+
3
+ module Overcommit::Hook::PostMerge
4
+ # Runs `npm install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::NpmInstall}
8
+ class NpmInstall < Base
9
+ include Overcommit::Hook::Shared::NpmInstall
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'overcommit/hook/shared/bower_install'
2
+
3
+ module Overcommit::Hook::PostRewrite
4
+ # Runs `bower install` when a change is detected in the repository's
5
+ # dependencies.
6
+ #
7
+ # @see {Overcommit::Hook::Shared::BowerInstall}
8
+ class BowerInstall < Base
9
+ include Overcommit::Hook::Shared::BowerInstall
10
+ end
11
+ end