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 +5 -5
- data/.gitignore +3 -3
- data/.travis.yml +4 -4
- data/CHANGELOG.md +16 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/danger-commit_lint.gemspec +8 -9
- data/lib/commit_lint/gem_version.rb +1 -1
- data/lib/commit_lint/plugin.rb +1 -0
- data/lib/commit_lint/subject_length_check.rb +9 -1
- data/spec/commit_lint_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/subject_length_check_spec.rb +43 -0
- metadata +29 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1d04af0c59f5c77e1ac87f91e0fb2a8cf40f4f81331c8e6880b76b5cd50a6e7e
|
4
|
+
data.tar.gz: 4ade3c85445d13bd8a8373d9658657f206d66d51553a21364af94f5b724ffc9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4d4f5210310603318820dd00e0d8a57ad08112963794ad86d1592561aac692aefd7f8362f3b1794f49a69895d2509ee23f0caf40315d903d223e7afd83f0969
|
7
|
+
data.tar.gz: 9209e4e1d275d418035202c24442a41622eac7d7d63be97d784092002a9e0b92f4142b6d211567d287f5ec5b8f02399cc97c524ca3c65cdd4ed7c6256a85349b
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -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.
|
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 (`
|
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
data/danger-commit_lint.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
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', '~>
|
20
|
+
spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
|
22
21
|
|
23
|
-
spec.add_development_dependency 'bundler'
|
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
|
data/lib/commit_lint/plugin.rb
CHANGED
@@ -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
|
-
|
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
|
data/spec/commit_lint_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path('
|
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:
|
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
|
data/spec/spec_helper.rb
CHANGED
@@ -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.
|
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:
|
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: '
|
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: '
|
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: '
|
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: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
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:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
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: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
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
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
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
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
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
|
-
|
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
|