overcommit 0.1.5 → 0.1.6

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: ee54344839806219b40d78711ba92a3d75807f78
4
- data.tar.gz: 943596ad2a69862b7495b714cb5a7047c86a6faa
3
+ metadata.gz: 8705a9603730e08028af8ed52da1d89b34701870
4
+ data.tar.gz: 36da43665b7fc82ac9e527a5bed18fe26343d072
5
5
  SHA512:
6
- metadata.gz: 38c3e9ab81ed52c14bca93297c3ad2fa9aefb6350460ccb6f46976a5559cc7c08638c3c3124d396e91a9349a376cadc9a7a812ca3b235baa9bb49898f1eabd84
7
- data.tar.gz: afeda1f2ba01a717d5b5d120ce8d1a5e3bba0fc77f68062d3a7994e81e35ecfe19061d106aeb445dd7488617292b00eafd647d478b6877096e40662cf8752000
6
+ metadata.gz: 02a1281d19da82fa562078b4c783f652b95e3eaa082cd938aa4507ff347e88206df91a892695084d78902340d6fed1ef71191a7c8635a415466bbf7d807ea785
7
+ data.tar.gz: 69850c03a18dd3831710074f0985c236f50b570f10a866fcae16314570a9b35594c5153df165078c731548292b98197616809a17f7740160695a7e7f7fc2f872
@@ -66,14 +66,16 @@ module Overcommit
66
66
  system("which #{cmd} &> /dev/null")
67
67
  end
68
68
 
69
- def commit_message
70
- @commit_message ||= begin
71
- unless @arguments[0] && ::File.exist?(@arguments[0])
72
- fail 'Not running in the context of a commit message'
73
- end
74
-
75
- File.readlines(@arguments[0])
69
+ def commit_message_file
70
+ unless @arguments[0] && ::File.exist?(@arguments[0])
71
+ fail 'Not running in the context of a commit message'
76
72
  end
73
+
74
+ @arguments[0]
75
+ end
76
+
77
+ def commit_message
78
+ @commit_message ||= ::IO.readlines(commit_message_file)
77
79
  end
78
80
 
79
81
  # Strip comments and diff (from git-commit --verbose)
@@ -5,10 +5,21 @@ module Overcommit::GitHook
5
5
  EMPTY_RELEASE_NOTE = /^release notes?\s*[:.]?\n{2,}/im
6
6
  def run_check
7
7
  if user_commit_message.join =~ EMPTY_RELEASE_NOTE
8
- return :warn, 'Empty release note found, either add one or remove it'
8
+ strip_release_note
9
+ return :warn, 'Empty release note found, automatically removed'
9
10
  end
10
11
 
11
12
  :good
12
13
  end
14
+
15
+ private
16
+
17
+ def strip_release_note
18
+ stripped_message = user_commit_message.join.sub(EMPTY_RELEASE_NOTE, '')
19
+
20
+ ::File.open(commit_message_file, 'w') do |file|
21
+ file.write(stripped_message)
22
+ end
23
+ end
13
24
  end
14
25
  end
@@ -0,0 +1,15 @@
1
+ module Overcommit::GitHook
2
+ class CoffeeLint < HookSpecificCheck
3
+ include HookRegistry
4
+ file_type :coffee
5
+
6
+ def run_check
7
+ unless in_path? 'coffeelint'
8
+ return :warn, 'Run `npm install -g coffeelint`'
9
+ end
10
+
11
+ output = `coffeelint --quiet #{(staged.join(' '))}`.split("\n")
12
+ return ($?.success? ? :good : :bad), output
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Overcommit::GitHook
2
+ class PythonFlake8 < HookSpecificCheck
3
+ include HookRegistry
4
+ file_type :py
5
+
6
+ def run_check
7
+ unless in_path? 'flake8'
8
+ return :warn, 'Run `pip install flake8`'
9
+ end
10
+
11
+ output = `flake8 #{(staged.join(' '))}`.split("\n")
12
+ return ($?.success? ? :good : :bad), output
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Overcommit
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  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.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Causes Engineering
@@ -47,11 +47,13 @@ files:
47
47
  - lib/overcommit/plugins/commit_msg/trailing_period.rb
48
48
  - lib/overcommit/plugins/pre_commit/author_name.rb
49
49
  - lib/overcommit/plugins/pre_commit/causes_email.rb
50
+ - lib/overcommit/plugins/pre_commit/coffee_lint.rb
50
51
  - lib/overcommit/plugins/pre_commit/css_linter.rb
51
52
  - lib/overcommit/plugins/pre_commit/erb_syntax.rb
52
53
  - lib/overcommit/plugins/pre_commit/haml_syntax.rb
53
54
  - lib/overcommit/plugins/pre_commit/js_console_log.rb
54
55
  - lib/overcommit/plugins/pre_commit/js_syntax.rb
56
+ - lib/overcommit/plugins/pre_commit/python_flake8.rb
55
57
  - lib/overcommit/plugins/pre_commit/restricted_paths.rb
56
58
  - lib/overcommit/plugins/pre_commit/ruby_syntax.rb
57
59
  - lib/overcommit/plugins/pre_commit/scss_lint.rb