overcommit 0.34.2 → 0.35.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86cc1bfaf7e0821dd1e60ef45df97899608fcdf2
4
- data.tar.gz: 01c697905ca074ece97b021c3e00413883b93f87
3
+ metadata.gz: e016461ee6c3433ae240bf3146a4b2ebbcd3917f
4
+ data.tar.gz: 5dabc49a054dbb3bd35a133ae1d69bef8fe3f0cb
5
5
  SHA512:
6
- metadata.gz: a8c3fe3d46646d86c24c4628ab9d552e2f167090deebc8b5ce0abf21828e9013e3cf4cd82f1fac349e01677b6883ec2705939da4eaacb23fe4e72efc3b9f6682
7
- data.tar.gz: d99729195dedd3ad2a7058c95f4fb6071886a151bf153cb8e724ba0784212a9cc06e7336266ecd9a91273e69f19a96d5f31bb74640465d8b8bd497bb87bf9fcf
6
+ metadata.gz: 0e883bebdc91a518fca9afad6c731b92f25af2634cc5057d9e5aa3e9a9e4e60732c511374766b311ceda7c3c253efeadff50518f913fb117c3d280a7702e2a2c
7
+ data.tar.gz: 403d7632314359323d12f44a672e3a5c782eb6c65d8f8eab0b4d6ef0088a3c7a2fc7ef8b7265cce129277ce006c8b0c804fdb4175d5b4eb091a0409f51339748
data/config/default.yml CHANGED
@@ -114,6 +114,12 @@ CommitMsg:
114
114
  enabled: true
115
115
  description: 'Check for trailing periods in subject'
116
116
 
117
+ Commitplease:
118
+ enabled: false
119
+ description: 'Analyze with Commitplease'
120
+ required_executable: './node_modules/.bin/commitplease'
121
+ install_command: 'npm install --save-dev commitplease'
122
+
117
123
  # Hooks that are run after `git commit` is executed, before the commit message
118
124
  # editor is displayed. These hooks are ideal for syntax checkers, linters, and
119
125
  # other checks that you want to run before you allow a commit object to be
@@ -150,20 +156,17 @@ PreCommit:
150
156
  - 'Berksfile'
151
157
  - 'Berksfile.lock'
152
158
 
153
- Brakeman:
154
- enabled: false
155
- description: 'Check for security vulnerabilities'
156
- required_executable: 'brakeman'
157
- flags: ['--exit-on-warn', '--quiet', '--summary', '--only-files']
158
- install_command: 'gem install brakeman'
159
- include:
160
- - '**/*.rb'
161
-
162
159
  BrokenSymlinks:
163
160
  enabled: true
164
161
  description: 'Check for broken symlinks'
165
162
  quiet: true
166
163
 
164
+ BundleAudit:
165
+ enabled: false
166
+ description: 'Check for vulnerable versions of gems'
167
+ required_executable: 'bundle-audit'
168
+ install_command: 'gem install bundler-audit'
169
+
167
170
  BundleCheck:
168
171
  enabled: false
169
172
  description: 'Check Gemfile dependencies'
@@ -205,6 +208,15 @@ PreCommit:
205
208
  install_command: 'npm install -g coffeelint'
206
209
  include: '**/*.coffee'
207
210
 
211
+ Credo:
212
+ enabled: false
213
+ description: 'Analyze with credo'
214
+ required_executable: 'mix'
215
+ flags: ['credo', '--all', '--strict', '--format', 'flycheck']
216
+ include:
217
+ - '**/*.ex'
218
+ - '**/*.exs'
219
+
208
220
  CssLint:
209
221
  enabled: false
210
222
  description: 'Analyze with csslint'
@@ -838,6 +850,11 @@ PrePush:
838
850
  command: ['ruby', '-Ilib:test', '-rminitest', "-e 'exit! Minitest.run'"]
839
851
  include: 'test/**/*_test.rb'
840
852
 
853
+ TestUnit:
854
+ enabled: false
855
+ description: 'Run Test::Unit test suite'
856
+ command: ['ruby', '-Ilib:test', '-rtest/unit', "-e 'exit! Test::Unit::AutoRunner.run'"]
857
+
841
858
  # Hooks that run during `git rebase`, before any commits are rebased.
842
859
  # If a hook fails, the rebase is aborted.
843
860
  PreRebase:
@@ -0,0 +1,14 @@
1
+ module Overcommit::Hook::CommitMsg
2
+ # Check that a commit message conforms to a certain style
3
+ #
4
+ # @see https://www.npmjs.com/package/commitplease
5
+ class Commitplease < Base
6
+ def run
7
+ result = execute(command)
8
+ output = result.stderr
9
+ return :pass if result.success? && output.empty?
10
+
11
+ [:fail, output]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ module Overcommit::Hook::PreCommit
2
+ # Checks for vulnerable versions of gems in Gemfile.lock.
3
+ #
4
+ # @see https://github.com/rubysec/bundler-audit
5
+ class BundleAudit < Base
6
+ LOCK_FILE = 'Gemfile.lock'.freeze
7
+
8
+ def run
9
+ # Ignore if Gemfile.lock is not tracked by git
10
+ ignored_files = execute(%w[git ls-files -o -i --exclude-standard]).stdout.split("\n")
11
+ return :pass if ignored_files.include?(LOCK_FILE)
12
+
13
+ result = execute(command)
14
+ if result.success?
15
+ :pass
16
+ else
17
+ return [:warn, result.stdout]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ module Overcommit::Hook::PreCommit
2
+ # Runs `credo` against any modified ex files.
3
+ #
4
+ # @see https://github.com/rrrene/credo
5
+ class Credo < Base
6
+ # example message:
7
+ # lib/file1.ex:1:11: R: Modules should have a @moduledoc tag.
8
+ # lib/file2.ex:12:81: R: Line is too long (max is 80, was 81).
9
+
10
+ def run
11
+ result = execute command
12
+ return :pass if result.success?
13
+
14
+ result.stdout.split("\n").map(&:strip).reject(&:empty?).
15
+ map { |error| message(error) }
16
+ end
17
+
18
+ private
19
+
20
+ def message(error)
21
+ file, line = error.split(':')
22
+ Overcommit::Hook::Message.new(:error, file, Integer(line), error)
23
+ end
24
+ end
25
+ end
@@ -3,18 +3,22 @@ module Overcommit::Hook::PreCommit
3
3
  #
4
4
  # @see http://checkstyle.sourceforge.net/
5
5
  class JavaCheckstyle < Base
6
- MESSAGE_REGEX = /^(\[[^\]]+\]\s+)?(?<file>(?:\w:)?[^:]+):(?<line>\d+)/
6
+ MESSAGE_REGEX = /^(\[(?<type>[^\]]+)\]\s+)?(?<file>(?:\w:)?[^:]+):(?<line>\d+)/
7
+
8
+ MESSAGE_TYPE_CATEGORIZER = lambda do |type|
9
+ %w[WARN INFO].include?(type.to_s) ? :warning : :error
10
+ end
7
11
 
8
12
  def run
9
13
  result = execute(command, args: applicable_files)
10
14
  output = result.stdout.chomp
11
- return :pass if result.success?
12
15
 
13
16
  # example message:
14
17
  # path/to/file.java:3:5: Error message
15
18
  extract_messages(
16
19
  output.split("\n").grep(MESSAGE_REGEX),
17
- MESSAGE_REGEX
20
+ MESSAGE_REGEX,
21
+ MESSAGE_TYPE_CATEGORIZER
18
22
  )
19
23
  end
20
24
  end
@@ -0,0 +1,14 @@
1
+ module Overcommit::Hook::PrePush
2
+ # Runs `test-unit` test suite before push
3
+ #
4
+ # @see https://github.com/test-unit/test-unit
5
+ class TestUnit < Base
6
+ def run
7
+ result = execute(command)
8
+ return :pass if result.success?
9
+
10
+ output = result.stdout + result.stderr
11
+ [:fail, output]
12
+ end
13
+ end
14
+ end
@@ -33,7 +33,7 @@ module Overcommit
33
33
  ensure_directory(hooks_path)
34
34
  preserve_old_hooks
35
35
  install_master_hook
36
- install_hook_symlinks
36
+ install_hook_files
37
37
  install_starter_config
38
38
 
39
39
  log.success "Successfully installed hooks into #{@target}"
@@ -42,7 +42,7 @@ module Overcommit
42
42
  def uninstall
43
43
  log.log "Removing hooks from #{@target}"
44
44
 
45
- uninstall_hook_symlinks
45
+ uninstall_hook_files
46
46
  uninstall_master_hook
47
47
  restore_old_hooks
48
48
 
@@ -54,7 +54,7 @@ module Overcommit
54
54
  unless FileUtils.compare_file(MASTER_HOOK, master_hook_install_path)
55
55
  preserve_old_hooks
56
56
  install_master_hook
57
- install_hook_symlinks
57
+ install_hook_files
58
58
 
59
59
  log.success "Hooks updated to Overcommit version #{Overcommit::VERSION}"
60
60
  true
@@ -103,10 +103,8 @@ module Overcommit
103
103
  FileUtils.rm_rf(master_hook_install_path, secure: true)
104
104
  end
105
105
 
106
- def install_hook_symlinks
107
- # Link each hook type (pre-commit, commit-msg, etc.) to the master hook.
108
- # We change directories so that the relative symlink paths work regardless
109
- # of where the repository is located.
106
+ def install_hook_files
107
+ # Copy each hook type (pre-commit, commit-msg, etc.) from the master hook.
110
108
  Dir.chdir(hooks_path) do
111
109
  Overcommit::Utils.supported_hook_types.each do |hook_type|
112
110
  unless can_replace_file?(hook_type)
@@ -115,7 +113,7 @@ module Overcommit
115
113
  'was not installed by Overcommit'
116
114
  end
117
115
  FileUtils.rm_f(hook_type)
118
- Overcommit::Utils::FileUtils.symlink('overcommit-hook', hook_type)
116
+ FileUtils.cp('overcommit-hook', hook_type)
119
117
  end
120
118
  end
121
119
  end
@@ -158,7 +156,7 @@ module Overcommit
158
156
  log.success "Successfully restored old hooks from #{old_hooks_path}"
159
157
  end
160
158
 
161
- def uninstall_hook_symlinks
159
+ def uninstall_hook_files
162
160
  return unless File.directory?(hooks_path)
163
161
 
164
162
  Dir.chdir(hooks_path) do
@@ -176,10 +174,7 @@ module Overcommit
176
174
  end
177
175
 
178
176
  def overcommit_hook?(file)
179
- return true if File.read(file) =~ /OVERCOMMIT_DISABLE/
180
- # TODO: Remove these checks once we hit version 1.0
181
- Overcommit::Utils::FileUtils.symlink?(file) &&
182
- Overcommit::Utils::FileUtils.readlink(file) == 'overcommit-hook'
177
+ File.read(file) =~ /OVERCOMMIT_DISABLE/
183
178
  rescue Errno::ENOENT
184
179
  # Some Ruby implementations (e.g. JRuby) raise an error when the file
185
180
  # doesn't exist. Standardize the behavior to return false.
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module Overcommit
5
- VERSION = '0.34.2'.freeze
5
+ VERSION = '0.35.0'.freeze
6
6
  end
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Entrypoint for Overcommit hook integration. Installing Overcommit will result
4
- # in all of your git hooks being symlinked to this file, allowing the framework
4
+ # in all of your git hooks being copied from this file, allowing the framework
5
5
  # to manage your hooks for you.
6
6
 
7
7
  # Prevent a Ruby stack trace from appearing when we interrupt the hook.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Entrypoint for Overcommit hook integration. Installing Overcommit will result
4
- # in all of your git hooks being symlinked to this file, allowing the framework
4
+ # in all of your git hooks being copied from this file, allowing the framework
5
5
  # to manage your hooks for you.
6
6
 
7
7
  # Prevent a Ruby stack trace from appearing when we interrupt the hook.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Entrypoint for Overcommit hook integration. Installing Overcommit will result
4
- # in all of your git hooks being symlinked to this file, allowing the framework
4
+ # in all of your git hooks being copied from this file, allowing the framework
5
5
  # to manage your hooks for you.
6
6
 
7
7
  # Prevent a Ruby stack trace from appearing when we interrupt the hook.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Entrypoint for Overcommit hook integration. Installing Overcommit will result
4
- # in all of your git hooks being symlinked to this file, allowing the framework
4
+ # in all of your git hooks being copied from this file, allowing the framework
5
5
  # to manage your hooks for you.
6
6
 
7
7
  # Prevent a Ruby stack trace from appearing when we interrupt the hook.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Entrypoint for Overcommit hook integration. Installing Overcommit will result
4
- # in all of your git hooks being symlinked to this file, allowing the framework
4
+ # in all of your git hooks being copied from this file, allowing the framework
5
5
  # to manage your hooks for you.
6
6
 
7
7
  # Prevent a Ruby stack trace from appearing when we interrupt the hook.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Entrypoint for Overcommit hook integration. Installing Overcommit will result
4
- # in all of your git hooks being symlinked to this file, allowing the framework
4
+ # in all of your git hooks being copied from this file, allowing the framework
5
5
  # to manage your hooks for you.
6
6
 
7
7
  # Prevent a Ruby stack trace from appearing when we interrupt the hook.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Entrypoint for Overcommit hook integration. Installing Overcommit will result
4
- # in all of your git hooks being symlinked to this file, allowing the framework
4
+ # in all of your git hooks being copied from this file, allowing the framework
5
5
  # to manage your hooks for you.
6
6
 
7
7
  # Prevent a Ruby stack trace from appearing when we interrupt the hook.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Entrypoint for Overcommit hook integration. Installing Overcommit will result
4
- # in all of your git hooks being symlinked to this file, allowing the framework
4
+ # in all of your git hooks being copied from this file, allowing the framework
5
5
  # to manage your hooks for you.
6
6
 
7
7
  # Prevent a Ruby stack trace from appearing when we interrupt the hook.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Entrypoint for Overcommit hook integration. Installing Overcommit will result
4
- # in all of your git hooks being symlinked to this file, allowing the framework
4
+ # in all of your git hooks being copied from this file, allowing the framework
5
5
  # to manage your hooks for you.
6
6
 
7
7
  # Prevent a Ruby stack trace from appearing when we interrupt the hook.
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.34.2
4
+ version: 0.35.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-06-27 00:00:00.000000000 Z
12
+ date: 2016-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: childprocess
@@ -65,6 +65,7 @@ files:
65
65
  - lib/overcommit/hook/base.rb
66
66
  - lib/overcommit/hook/commit_msg/base.rb
67
67
  - lib/overcommit/hook/commit_msg/capitalized_subject.rb
68
+ - lib/overcommit/hook/commit_msg/commitplease.rb
68
69
  - lib/overcommit/hook/commit_msg/empty_message.rb
69
70
  - lib/overcommit/hook/commit_msg/gerrit_change_id.rb
70
71
  - lib/overcommit/hook/commit_msg/hard_tabs.rb
@@ -103,13 +104,14 @@ files:
103
104
  - lib/overcommit/hook/pre_commit/author_name.rb
104
105
  - lib/overcommit/hook/pre_commit/base.rb
105
106
  - lib/overcommit/hook/pre_commit/berksfile_check.rb
106
- - lib/overcommit/hook/pre_commit/brakeman.rb
107
107
  - lib/overcommit/hook/pre_commit/broken_symlinks.rb
108
+ - lib/overcommit/hook/pre_commit/bundle_audit.rb
108
109
  - lib/overcommit/hook/pre_commit/bundle_check.rb
109
110
  - lib/overcommit/hook/pre_commit/bundle_outdated.rb
110
111
  - lib/overcommit/hook/pre_commit/case_conflicts.rb
111
112
  - lib/overcommit/hook/pre_commit/chamber_security.rb
112
113
  - lib/overcommit/hook/pre_commit/coffee_lint.rb
114
+ - lib/overcommit/hook/pre_commit/credo.rb
113
115
  - lib/overcommit/hook/pre_commit/css_lint.rb
114
116
  - lib/overcommit/hook/pre_commit/dogma.rb
115
117
  - lib/overcommit/hook/pre_commit/es_lint.rb
@@ -164,6 +166,7 @@ files:
164
166
  - lib/overcommit/hook/pre_push/minitest.rb
165
167
  - lib/overcommit/hook/pre_push/protected_branches.rb
166
168
  - lib/overcommit/hook/pre_push/r_spec.rb
169
+ - lib/overcommit/hook/pre_push/test_unit.rb
167
170
  - lib/overcommit/hook/pre_rebase/base.rb
168
171
  - lib/overcommit/hook/pre_rebase/merged_commits.rb
169
172
  - lib/overcommit/hook/shared/bower_install.rb
@@ -221,7 +224,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
221
224
  requirements:
222
225
  - - ">="
223
226
  - !ruby/object:Gem::Version
224
- version: 1.9.3
227
+ version: '2'
225
228
  required_rubygems_version: !ruby/object:Gem::Requirement
226
229
  requirements:
227
230
  - - ">="
@@ -1,13 +0,0 @@
1
- module Overcommit::Hook::PreCommit
2
- # Runs `brakeman` against any modified Ruby/Rails files.
3
- #
4
- # @see http://brakemanscanner.org/
5
- class Brakeman < Base
6
- def run
7
- result = execute(command + [applicable_files.join(',')])
8
- return :pass if result.success?
9
-
10
- [:fail, result.stdout]
11
- end
12
- end
13
- end