danger-commit_lint 0.0.6 → 0.0.7

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
- SHA1:
3
- metadata.gz: 8cbe2ac467463b1a4ed6bdd55beb2a39d991517d
4
- data.tar.gz: 3cd3091eb64b256b808ba757fa8769b4c7333368
2
+ SHA256:
3
+ metadata.gz: 1d04af0c59f5c77e1ac87f91e0fb2a8cf40f4f81331c8e6880b76b5cd50a6e7e
4
+ data.tar.gz: 4ade3c85445d13bd8a8373d9658657f206d66d51553a21364af94f5b724ffc9a
5
5
  SHA512:
6
- metadata.gz: f3755d483cec1c678c406a55c3f9fa465e9780a59c6a59ce419c9e4414b0693e259ed476027232f7adbb35db12455b6d90d9ac0ef05808c93ef6ca92cbc8352b
7
- data.tar.gz: dcb200e7dcb02000d1295f7b9671bcb396b83dc7ce3cd827b4148cff2e67f031ae2c57c93294b4802ebb5a2cff55ad13e4d5f8ca44e23630e39e80cbcfdd6b11
6
+ metadata.gz: d4d4f5210310603318820dd00e0d8a57ad08112963794ad86d1592561aac692aefd7f8362f3b1794f49a69895d2509ee23f0caf40315d903d223e7afd83f0969
7
+ data.tar.gz: 9209e4e1d275d418035202c24442a41622eac7d7d63be97d784092002a9e0b92f4142b6d211567d287f5ec5b8f02399cc97c524ca3c65cdd4ed7c6256a85349b
data/.gitignore CHANGED
@@ -1,7 +1,7 @@
1
1
  .DS_Store
2
- pkg
3
2
  .idea/
4
- Gemfile.lock
5
- .ruby-version
6
3
  .ruby-gemset
4
+ .ruby-version
7
5
  .yardoc/
6
+ Gemfile.lock
7
+ pkg
@@ -3,10 +3,10 @@ language: ruby
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
- - 2.2
7
- - 2.3.3
8
- - 2.4.0
9
- - jruby-9
6
+ - 2.4.5
7
+ - 2.5.5
8
+ - 2.6.2
9
+ - jruby-9.2.6.0
10
10
 
11
11
  script:
12
12
  - bundle exec rake
@@ -10,7 +10,22 @@ The format is based on [Keep a Changelog][keep] and this project adheres to
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
- [Unreleased]: https://github.com/jonallured/danger-commit_lint/compare/v0.0.6...master
13
+ [Unreleased]: https://github.com/jonallured/danger-commit_lint/compare/v0.0.7...master
14
+
15
+ ## [0.0.7] - 2019-03-29
16
+
17
+ ### Changed
18
+
19
+ * Ignore git generated subject in commit messages [#21][]
20
+ * Express danger plugin dependency in terms of plugin api [#24][]
21
+
22
+ [0.0.7]: https://github.com/jonallured/danger-commit_lint/compare/v0.0.6...v0.0.7
23
+ [#21]: https://github.com/jonallured/danger-commit_lint/pull/21
24
+ [#24]: https://github.com/jonallured/danger-commit_lint/pull/24
25
+
26
+ ### Removed
27
+
28
+ * Drop Ruby 2.3 from Travis [1aa9cff][1aa9cff]
14
29
 
15
30
  ## [0.0.6] - 2017-04-27
16
31
 
data/README.md CHANGED
@@ -28,7 +28,7 @@ commit_lint.check
28
28
  That will check each commit in the PR to ensure the following is true:
29
29
 
30
30
  * Commit subject begins with a capital letter (`subject_cap`)
31
- * Commit subject is more than one word (`subject_word`)
31
+ * Commit subject is more than one word (`subject_words`)
32
32
  * Commit subject is no longer than 50 characters (`subject_length`)
33
33
  * Commit subject does not end in a period (`subject_period`)
34
34
  * Commit subject and body are separated by an empty line (`empty_line`)
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rubocop/rake_task'
4
4
 
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
- task default: [:spec, :rubocop, :spec_docs]
7
+ task default: %i[rubocop spec spec_docs]
8
8
 
9
9
  desc 'Run RuboCop on the lib/specs directory'
10
10
  RuboCop::RakeTask.new(:rubocop) do |task|
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'commit_lint/gem_version.rb'
5
4
 
@@ -13,17 +12,17 @@ Gem::Specification.new do |spec|
13
12
  spec.homepage = 'https://github.com/jonallured/danger-commit_lint'
14
13
  spec.license = 'MIT'
15
14
 
16
- spec.files = `git ls-files`.split($/)
15
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
18
  spec.require_paths = ['lib']
20
19
 
21
- spec.add_runtime_dependency 'danger', '~> 5.0'
20
+ spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
22
21
 
23
- spec.add_development_dependency 'bundler', '~> 1.3'
24
- spec.add_development_dependency 'rake'
25
- spec.add_development_dependency 'rspec', '~> 3.4'
26
- spec.add_development_dependency "rubocop", "~> 0.41"
27
- spec.add_development_dependency "yard", "~> 0.8"
22
+ spec.add_development_dependency 'bundler'
28
23
  spec.add_development_dependency 'pry'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec'
26
+ spec.add_development_dependency 'rubocop'
27
+ spec.add_development_dependency 'yard'
29
28
  end
@@ -1,3 +1,3 @@
1
1
  module CommitLint
2
- VERSION = '0.0.6'.freeze
2
+ VERSION = '0.0.7'.freeze
3
3
  end
@@ -113,6 +113,7 @@ module Danger
113
113
 
114
114
  def warning_checks
115
115
  return checks if @config[:warn] == :all
116
+
116
117
  @config[:warn] || []
117
118
  end
118
119
 
@@ -2,6 +2,10 @@ module Danger
2
2
  class DangerCommitLint < Plugin
3
3
  class SubjectLengthCheck < CommitCheck # :nodoc:
4
4
  MESSAGE = 'Please limit commit subject line to 50 characters.'.freeze
5
+ GIT_GENERATED_SUBJECT = /^Merge branch \'.+\' into\ /.freeze
6
+ GITHUB_GENERATED_SUBJECT = /^Merge pull request #\d+ from\ /.freeze
7
+
8
+ attr_reader :subject
5
9
 
6
10
  def self.type
7
11
  :subject_length
@@ -12,7 +16,11 @@ module Danger
12
16
  end
13
17
 
14
18
  def fail?
15
- @subject.length > 50
19
+ subject.length > 50 && !merge_commit?
20
+ end
21
+
22
+ def merge_commit?
23
+ subject =~ /#{GIT_GENERATED_SUBJECT}|#{GITHUB_GENERATED_SUBJECT}/
16
24
  end
17
25
  end
18
26
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../spec_helper', __FILE__)
1
+ require File.expand_path('spec_helper', __dir__)
2
2
 
3
3
  # rubocop:disable Metrics/LineLength
4
4
 
@@ -9,7 +9,7 @@ TEST_MESSAGES = {
9
9
  subject_period: 'This subject line ends in a period.',
10
10
  empty_line: "This subject line is fine\nBut then I forgot the empty line separating the subject and the body.",
11
11
  all_errors: "this is a really long subject and it even ends in a period.\nNot to mention the missing empty line!",
12
- valid: "This is a valid message\n\nYou can tell because it meets all the criteria and the linter does not complain."
12
+ valid: "This is a valid message\n\nYou can tell because it meets all the criteria and the linter does not complain."
13
13
  }.freeze
14
14
 
15
15
  # rubocop:enable Metrics/LineLength
@@ -1,5 +1,5 @@
1
1
  require 'pathname'
2
- ROOT = Pathname.new(File.expand_path('../../', __FILE__))
2
+ ROOT = Pathname.new(File.expand_path('..', __dir__))
3
3
  $LOAD_PATH.unshift((ROOT + 'lib').to_s)
4
4
  $LOAD_PATH.unshift((ROOT + 'spec').to_s)
5
5
 
@@ -0,0 +1,43 @@
1
+ require File.expand_path('spec_helper', __dir__)
2
+
3
+ describe Danger::DangerCommitLint::SubjectLengthCheck do
4
+ describe '#fail?' do
5
+ let(:commit_subject) { 'This is a common valid commit message' }
6
+
7
+ let(:message) do
8
+ {
9
+ subject: commit_subject
10
+ }
11
+ end
12
+
13
+ subject do
14
+ described_class.new(message).fail?
15
+ end
16
+
17
+ it { expect(subject).to be_falsy }
18
+
19
+ context 'when message is invalid' do
20
+ let(:commit_subject) do
21
+ 'This is a really long subject line and should result in an error'
22
+ end
23
+
24
+ it { expect(subject).to be_truthy }
25
+ end
26
+
27
+ context 'when message is a merge commit generated by git' do
28
+ let(:commit_subject) do
29
+ "Merge branch 'ignore-length-on-git-merge-commits' into master"
30
+ end
31
+
32
+ it { expect(subject).to be_falsy }
33
+ end
34
+
35
+ context 'when message is a merge commit generated by GitHub' do
36
+ let(:commit_subject) do
37
+ 'Merge pull request #1234 from jonallured/ignore-length-merge-commits'
38
+ end
39
+
40
+ it { expect(subject).to be_falsy }
41
+ end
42
+ end
43
+ end
metadata CHANGED
@@ -1,45 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-commit_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Allured
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-27 00:00:00.000000000 Z
11
+ date: 2019-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: danger
14
+ name: danger-plugin-api
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,49 +53,49 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.4'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '3.4'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rubocop
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0.41'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0.41'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: yard
84
+ name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0.8'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0.8'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: pry
98
+ name: yard
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -137,6 +137,7 @@ files:
137
137
  - lib/danger_plugin.rb
138
138
  - spec/commit_lint_spec.rb
139
139
  - spec/spec_helper.rb
140
+ - spec/subject_length_check_spec.rb
140
141
  homepage: https://github.com/jonallured/danger-commit_lint
141
142
  licenses:
142
143
  - MIT
@@ -156,8 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
157
  - !ruby/object:Gem::Version
157
158
  version: '0'
158
159
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 2.6.11
160
+ rubygems_version: 3.0.3
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: A Danger Plugin that ensure commit messages are not too long, don't end in
@@ -165,3 +165,4 @@ summary: A Danger Plugin that ensure commit messages are not too long, don't end
165
165
  test_files:
166
166
  - spec/commit_lint_spec.rb
167
167
  - spec/spec_helper.rb
168
+ - spec/subject_length_check_spec.rb