git-lint 1.4.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.adoc +37 -139
- data/lib/git/lint.rb +18 -50
- data/lib/git/lint/analyzers/abstract.rb +12 -30
- data/lib/git/lint/analyzers/commit_author_capitalization.rb +1 -3
- data/lib/git/lint/analyzers/commit_author_email.rb +1 -3
- data/lib/git/lint/analyzers/commit_author_name.rb +2 -4
- data/lib/git/lint/analyzers/commit_body_bullet.rb +2 -6
- data/lib/git/lint/analyzers/commit_body_bullet_capitalization.rb +3 -9
- data/lib/git/lint/analyzers/commit_body_bullet_delimiter.rb +4 -12
- data/lib/git/lint/analyzers/commit_body_issue_tracker_link.rb +3 -9
- data/lib/git/lint/analyzers/commit_body_leading_line.rb +3 -3
- data/lib/git/lint/analyzers/commit_body_line_length.rb +3 -9
- data/lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb +3 -9
- data/lib/git/lint/analyzers/commit_body_phrase.rb +2 -6
- data/lib/git/lint/analyzers/commit_body_presence.rb +2 -4
- data/lib/git/lint/analyzers/commit_body_single_bullet.rb +3 -9
- data/lib/git/lint/analyzers/commit_subject_length.rb +2 -6
- data/lib/git/lint/analyzers/commit_subject_prefix.rb +2 -10
- data/lib/git/lint/analyzers/commit_subject_suffix.rb +1 -3
- data/lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb +2 -4
- data/lib/git/lint/analyzers/commit_trailer_collaborator_duplication.rb +3 -5
- data/lib/git/lint/analyzers/commit_trailer_collaborator_email.rb +2 -4
- data/lib/git/lint/analyzers/commit_trailer_collaborator_key.rb +3 -7
- data/lib/git/lint/analyzers/commit_trailer_collaborator_name.rb +3 -7
- data/lib/git/lint/branches/environments/circle_ci.rb +5 -9
- data/lib/git/lint/branches/environments/git_hub_action.rb +5 -9
- data/lib/git/lint/branches/environments/local.rb +5 -9
- data/lib/git/lint/branches/environments/netlify_ci.rb +9 -11
- data/lib/git/lint/branches/environments/travis_ci.rb +14 -22
- data/lib/git/lint/branches/feature.rb +6 -9
- data/lib/git/lint/cli.rb +10 -15
- data/lib/git/lint/collector.rb +12 -32
- data/lib/git/lint/identity.rb +1 -1
- data/lib/git/lint/kit/filter_list.rb +3 -9
- data/lib/git/lint/parsers/trailers/collaborator.rb +6 -14
- data/lib/git/lint/rake/tasks.rb +1 -3
- data/lib/git/lint/refinements/strings.rb +2 -6
- data/lib/git/lint/reporters/branch.rb +15 -15
- data/lib/git/lint/reporters/commit.rb +1 -3
- data/lib/git/lint/reporters/line.rb +1 -3
- data/lib/git/lint/reporters/lines/paragraph.rb +5 -15
- data/lib/git/lint/reporters/lines/sentence.rb +3 -9
- data/lib/git/lint/reporters/style.rb +1 -3
- data/lib/git/lint/runner.rb +5 -4
- data/lib/git/lint/validators/capitalization.rb +3 -7
- data/lib/git/lint/validators/email.rb +1 -3
- data/lib/git/lint/validators/name.rb +3 -7
- metadata +46 -21
- metadata.gz.sig +0 -0
- data/lib/git/kit/repo.rb +0 -30
- data/lib/git/lint/commits/saved.rb +0 -104
- data/lib/git/lint/commits/unsaved.rb +0 -120
data/lib/git/lint/rake/tasks.rb
CHANGED
@@ -7,7 +7,7 @@ module Git
|
|
7
7
|
module Reporters
|
8
8
|
# Reports issues related to a single branch.
|
9
9
|
class Branch
|
10
|
-
using Refinements::Strings
|
10
|
+
using GitPlus::Refinements::Strings
|
11
11
|
|
12
12
|
def initialize collector: Collector.new, colorizer: Pastel.new
|
13
13
|
@collector = collector
|
@@ -23,22 +23,30 @@ module Git
|
|
23
23
|
|
24
24
|
attr_reader :collector, :colorizer
|
25
25
|
|
26
|
+
def branch_report
|
27
|
+
return "" unless collector.issues?
|
28
|
+
|
29
|
+
"\n\n#{commit_report}".chomp
|
30
|
+
end
|
31
|
+
|
26
32
|
def commit_report
|
27
33
|
collector.to_h.reduce "" do |details, (commit, analyzers)|
|
28
34
|
details + Commit.new(commit: commit, analyzers: analyzers).to_s
|
29
35
|
end
|
30
36
|
end
|
31
37
|
|
32
|
-
def branch_report
|
33
|
-
return "" unless collector.issues?
|
34
|
-
|
35
|
-
"\n\n#{commit_report}".chomp "\n"
|
36
|
-
end
|
37
|
-
|
38
38
|
def commit_total
|
39
39
|
%(#{"commit".pluralize count: collector.total_commits} inspected)
|
40
40
|
end
|
41
41
|
|
42
|
+
def issue_totals
|
43
|
+
if collector.issues?
|
44
|
+
"#{issue_total} detected (#{warning_total}, #{error_total})"
|
45
|
+
else
|
46
|
+
colorizer.green("0 issues") + " detected"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
42
50
|
def issue_total
|
43
51
|
color = collector.errors? ? :red : :yellow
|
44
52
|
colorizer.public_send color, "issue".pluralize(count: collector.total_issues)
|
@@ -53,14 +61,6 @@ module Git
|
|
53
61
|
color = collector.errors? ? :red : :green
|
54
62
|
colorizer.public_send color, "error".pluralize(count: collector.total_errors)
|
55
63
|
end
|
56
|
-
|
57
|
-
def issue_totals
|
58
|
-
if collector.issues?
|
59
|
-
"#{issue_total} detected (#{warning_total}, #{error_total})"
|
60
|
-
else
|
61
|
-
colorizer.green("0 issues") + " detected"
|
62
|
-
end
|
63
|
-
end
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -21,9 +21,7 @@ module Git
|
|
21
21
|
|
22
22
|
attr_reader :commit, :analyzers
|
23
23
|
|
24
|
-
def report
|
25
|
-
analyzers.reduce("") { |report, analyzer| report + Style.new(analyzer).to_s }
|
26
|
-
end
|
24
|
+
def report = analyzers.reduce("") { |report, analyzer| report + Style.new(analyzer).to_s }
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
@@ -17,13 +17,9 @@ module Git
|
|
17
17
|
|
18
18
|
attr_reader :data
|
19
19
|
|
20
|
-
def label
|
21
|
-
"#{Line::DEFAULT_INDENT}Line #{number}: "
|
22
|
-
end
|
20
|
+
def label = "#{Line::DEFAULT_INDENT}Line #{number}: "
|
23
21
|
|
24
|
-
def paragraph
|
25
|
-
formatted_lines.join "\n"
|
26
|
-
end
|
22
|
+
def paragraph = formatted_lines.join("\n")
|
27
23
|
|
28
24
|
def formatted_lines
|
29
25
|
content.split("\n").map.with_index do |line, index|
|
@@ -31,17 +27,11 @@ module Git
|
|
31
27
|
end
|
32
28
|
end
|
33
29
|
|
34
|
-
def indent
|
35
|
-
" " * (label.length + 1)
|
36
|
-
end
|
30
|
+
def indent = " " * (label.length + 1)
|
37
31
|
|
38
|
-
def number
|
39
|
-
data.fetch :number
|
40
|
-
end
|
32
|
+
def number = data.fetch(:number)
|
41
33
|
|
42
|
-
def content
|
43
|
-
data.fetch :content
|
44
|
-
end
|
34
|
+
def content = data.fetch(:content)
|
45
35
|
end
|
46
36
|
end
|
47
37
|
end
|
@@ -9,21 +9,15 @@ module Git
|
|
9
9
|
@data = data
|
10
10
|
end
|
11
11
|
|
12
|
-
def to_s
|
13
|
-
%(#{Line::DEFAULT_INDENT}Line #{number}: "#{content}"\n)
|
14
|
-
end
|
12
|
+
def to_s = %(#{Line::DEFAULT_INDENT}Line #{number}: "#{content}"\n)
|
15
13
|
|
16
14
|
private
|
17
15
|
|
18
16
|
attr_reader :data
|
19
17
|
|
20
|
-
def number
|
21
|
-
data.fetch :number
|
22
|
-
end
|
18
|
+
def number = data.fetch(:number)
|
23
19
|
|
24
|
-
def content
|
25
|
-
data.fetch :content
|
26
|
-
end
|
20
|
+
def content = data.fetch(:content)
|
27
21
|
end
|
28
22
|
end
|
29
23
|
end
|
data/lib/git/lint/runner.rb
CHANGED
@@ -3,19 +3,20 @@
|
|
3
3
|
module Git
|
4
4
|
module Lint
|
5
5
|
class Runner
|
6
|
-
def initialize configuration:, collector: Collector.new
|
6
|
+
def initialize configuration:, branch: Branches::Feature.new, collector: Collector.new
|
7
7
|
@configuration = configuration
|
8
|
+
@branch = branch
|
8
9
|
@collector = collector
|
9
10
|
end
|
10
11
|
|
11
|
-
def call commits:
|
12
|
-
|
12
|
+
def call commits: branch.commits
|
13
|
+
commits.map { |commit| check commit }
|
13
14
|
collector
|
14
15
|
end
|
15
16
|
|
16
17
|
private
|
17
18
|
|
18
|
-
attr_reader :configuration, :collector
|
19
|
+
attr_reader :configuration, :branch, :collector
|
19
20
|
|
20
21
|
def check commit
|
21
22
|
configuration.map { |id, settings| load_analyzer id, commit, settings }
|
@@ -4,7 +4,7 @@ module Git
|
|
4
4
|
module Lint
|
5
5
|
module Validators
|
6
6
|
class Capitalization
|
7
|
-
DEFAULT_PATTERN = /\A[[:upper:]].*\Z
|
7
|
+
DEFAULT_PATTERN = /\A[[:upper:]].*\Z/
|
8
8
|
|
9
9
|
def initialize text, delimiter: Name::DEFAULT_DELIMITER, pattern: DEFAULT_PATTERN
|
10
10
|
@text = String text
|
@@ -12,17 +12,13 @@ module Git
|
|
12
12
|
@pattern = pattern
|
13
13
|
end
|
14
14
|
|
15
|
-
def valid?
|
16
|
-
parts.all? { |name| String(name).match? pattern }
|
17
|
-
end
|
15
|
+
def valid? = parts.all? { |name| String(name).match? pattern }
|
18
16
|
|
19
17
|
private
|
20
18
|
|
21
19
|
attr_reader :text, :delimiter, :pattern
|
22
20
|
|
23
|
-
def parts
|
24
|
-
text.split delimiter
|
25
|
-
end
|
21
|
+
def parts = text.split(delimiter)
|
26
22
|
end
|
27
23
|
end
|
28
24
|
end
|
@@ -4,7 +4,7 @@ module Git
|
|
4
4
|
module Lint
|
5
5
|
module Validators
|
6
6
|
class Name
|
7
|
-
DEFAULT_DELIMITER = /\s{1}
|
7
|
+
DEFAULT_DELIMITER = /\s{1}/
|
8
8
|
DEFAULT_MINIMUM = 2
|
9
9
|
|
10
10
|
def initialize text, delimiter: DEFAULT_DELIMITER, minimum: DEFAULT_MINIMUM
|
@@ -13,17 +13,13 @@ module Git
|
|
13
13
|
@minimum = minimum
|
14
14
|
end
|
15
15
|
|
16
|
-
def valid?
|
17
|
-
parts.size >= minimum && parts.all? { |name| !String(name).empty? }
|
18
|
-
end
|
16
|
+
def valid? = parts.size >= minimum && parts.all? { |name| !String(name).empty? }
|
19
17
|
|
20
18
|
private
|
21
19
|
|
22
20
|
attr_reader :text, :delimiter, :minimum
|
23
21
|
|
24
|
-
def parts
|
25
|
-
String(text).split delimiter
|
26
|
-
end
|
22
|
+
def parts = String(text).split(delimiter)
|
27
23
|
end
|
28
24
|
end
|
29
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIC/
|
14
|
-
|
15
|
-
|
13
|
+
MIIC/jCCAeagAwIBAgIBBDANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMTAzMTkxMjQ4MDZaFw0yMjAzMTkx
|
15
|
+
MjQ4MDZaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
16
16
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
17
17
|
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
18
18
|
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
@@ -20,16 +20,30 @@ cert_chain:
|
|
20
20
|
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
21
21
|
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
22
22
|
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
23
|
-
2CdikiiE3fJhP/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAEjpaOXHHp8s/7GL2qCb
|
24
|
+
YAs7urOLv9VHSPfQWAwaTMVnSsIf3Sw4xzISOP/mmfEPBPXtz61K5esrE/uTFtgb
|
25
|
+
FyjxQk2H0sEWgrRXGGNHBWQRhhEs7LP/TByoC15A0br++xLxRz4r7HBLGAWQQDpg
|
26
|
+
66BJ2TBVjxS6K64tKbq7+ACyrOZGgTfNHACh4M076y0x0oRf/rwBrU39/KRfuhbb
|
27
|
+
cm+nNCEtO35gTmZ2bVDHLGvWazi3gJt6+huQjfXTCUUG2YYBxwhu+GPdAGQPxpf9
|
28
|
+
lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
|
29
|
+
W2A=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date:
|
31
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: git_plus
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.5'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.5'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: pastel
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,28 +64,28 @@ dependencies:
|
|
50
64
|
requirements:
|
51
65
|
- - "~>"
|
52
66
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
67
|
+
version: '8.0'
|
54
68
|
type: :runtime
|
55
69
|
prerelease: false
|
56
70
|
version_requirements: !ruby/object:Gem::Requirement
|
57
71
|
requirements:
|
58
72
|
- - "~>"
|
59
73
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
74
|
+
version: '8.0'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: runcom
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
64
78
|
requirements:
|
65
79
|
- - "~>"
|
66
80
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
81
|
+
version: '7.0'
|
68
82
|
type: :runtime
|
69
83
|
prerelease: false
|
70
84
|
version_requirements: !ruby/object:Gem::Requirement
|
71
85
|
requirements:
|
72
86
|
- - "~>"
|
73
87
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
88
|
+
version: '7.0'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: thor
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +100,20 @@ dependencies:
|
|
86
100
|
- - "~>"
|
87
101
|
- !ruby/object:Gem::Version
|
88
102
|
version: '0.20'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: zeitwerk
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '2.4'
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '2.4'
|
89
117
|
description:
|
90
118
|
email:
|
91
119
|
- brooke@alchemists.io
|
@@ -99,7 +127,6 @@ files:
|
|
99
127
|
- LICENSE.adoc
|
100
128
|
- README.adoc
|
101
129
|
- bin/git-lint
|
102
|
-
- lib/git/kit/repo.rb
|
103
130
|
- lib/git/lint.rb
|
104
131
|
- lib/git/lint/analyzers/abstract.rb
|
105
132
|
- lib/git/lint/analyzers/commit_author_capitalization.rb
|
@@ -131,8 +158,6 @@ files:
|
|
131
158
|
- lib/git/lint/branches/feature.rb
|
132
159
|
- lib/git/lint/cli.rb
|
133
160
|
- lib/git/lint/collector.rb
|
134
|
-
- lib/git/lint/commits/saved.rb
|
135
|
-
- lib/git/lint/commits/unsaved.rb
|
136
161
|
- lib/git/lint/errors/base.rb
|
137
162
|
- lib/git/lint/errors/severity.rb
|
138
163
|
- lib/git/lint/errors/sha.rb
|
@@ -168,14 +193,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
193
|
requirements:
|
169
194
|
- - "~>"
|
170
195
|
- !ruby/object:Gem::Version
|
171
|
-
version: '
|
196
|
+
version: '3.0'
|
172
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
198
|
requirements:
|
174
199
|
- - ">="
|
175
200
|
- !ruby/object:Gem::Version
|
176
201
|
version: '0'
|
177
202
|
requirements: []
|
178
|
-
rubygems_version: 3.2.
|
203
|
+
rubygems_version: 3.2.21
|
179
204
|
signing_key:
|
180
205
|
specification_version: 4
|
181
206
|
summary: A command line interface for linting Git commits.
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/git/kit/repo.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Git
|
4
|
-
module Kit
|
5
|
-
class Repo
|
6
|
-
def initialize shell: Open3
|
7
|
-
@shell = shell
|
8
|
-
end
|
9
|
-
|
10
|
-
def exist?
|
11
|
-
shell.capture2e("git rev-parse --git-dir > /dev/null 2>&1")
|
12
|
-
.then { |result, status| result && status.success? }
|
13
|
-
end
|
14
|
-
|
15
|
-
def branch_name
|
16
|
-
shell.capture2e("git rev-parse --abbrev-ref HEAD | tr -d '\n'")
|
17
|
-
.then { |result, _status| result }
|
18
|
-
end
|
19
|
-
|
20
|
-
def shas start: "master", finish: branch_name
|
21
|
-
shell.capture2e(%(git log --pretty=format:"%H" #{start}..#{finish}))
|
22
|
-
.then { |result, _status| result.split "\n" }
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
attr_reader :shell
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|