git-lint 5.3.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +195 -137
- data/git-lint.gemspec +12 -9
- data/lib/git/lint/analyzer.rb +9 -11
- data/lib/git/lint/analyzers/abstract.rb +6 -11
- data/lib/git/lint/analyzers/commit_author_name.rb +1 -1
- data/lib/git/lint/analyzers/commit_body_bullet.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_bullet_capitalization.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_bullet_delimiter.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_line_length.rb +1 -1
- data/lib/git/lint/analyzers/commit_body_phrase.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_presence.rb +1 -1
- data/lib/git/lint/analyzers/commit_body_single_bullet.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_tracker_shorthand.rb +3 -1
- data/lib/git/lint/analyzers/commit_signature.rb +3 -1
- data/lib/git/lint/analyzers/commit_subject_length.rb +1 -1
- data/lib/git/lint/analyzers/commit_subject_prefix.rb +5 -3
- data/lib/git/lint/analyzers/commit_subject_suffix.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_collaborator_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_collaborator_name.rb +1 -1
- data/lib/git/lint/analyzers/commit_trailer_format_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_format_value.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_issue_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_issue_value.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_signer_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_signer_name.rb +1 -1
- data/lib/git/lint/analyzers/commit_trailer_tracker_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_tracker_value.rb +3 -1
- data/lib/git/lint/cli/actions/analyze/branch.rb +8 -2
- data/lib/git/lint/cli/actions/analyze/commit.rb +7 -1
- data/lib/git/lint/cli/actions/hook.rb +8 -1
- data/lib/git/lint/cli/shell.rb +26 -27
- data/lib/git/lint/configuration/contract.rb +103 -0
- data/lib/git/lint/configuration/defaults.yml +177 -162
- data/lib/git/lint/configuration/model.rb +97 -0
- data/lib/git/lint/container.rb +16 -2
- data/lib/git/lint/rake/register.rb +1 -1
- data/lib/git/lint/reporters/style.rb +4 -4
- data.tar.gz.sig +0 -0
- metadata +62 -27
- metadata.gz.sig +0 -0
- data/lib/git/lint/cli/actions/config.rb +0 -35
- data/lib/git/lint/cli/actions/container.rb +0 -23
- data/lib/git/lint/cli/actions/import.rb +0 -13
- data/lib/git/lint/cli/parser.rb +0 -37
- data/lib/git/lint/cli/parsers/analyze.rb +0 -41
- data/lib/git/lint/cli/parsers/core.rb +0 -76
- data/lib/git/lint/configuration/content.rb +0 -26
- data/lib/git/lint/configuration/loader.rb +0 -50
- data/lib/git/lint/configuration/setting.rb +0 -25
@@ -1,162 +1,177 @@
|
|
1
|
-
:
|
2
|
-
:
|
3
|
-
:
|
4
|
-
|
5
|
-
|
6
|
-
:
|
7
|
-
|
8
|
-
|
9
|
-
:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
:
|
88
|
-
:
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
:
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
:
|
115
|
-
|
116
|
-
|
117
|
-
:
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
:
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
:
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
:
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
:
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
:
|
154
|
-
|
155
|
-
|
156
|
-
:
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
1
|
+
commits:
|
2
|
+
author:
|
3
|
+
capitalization:
|
4
|
+
enabled: true
|
5
|
+
severity: error
|
6
|
+
email:
|
7
|
+
enabled: true
|
8
|
+
severity: error
|
9
|
+
name:
|
10
|
+
enabled: true
|
11
|
+
severity: error
|
12
|
+
minimum: 2
|
13
|
+
body:
|
14
|
+
bullet:
|
15
|
+
enabled: true
|
16
|
+
severity: error
|
17
|
+
excludes:
|
18
|
+
- "\\*"
|
19
|
+
- "•"
|
20
|
+
bullet_capitalization:
|
21
|
+
enabled: true
|
22
|
+
severity: error
|
23
|
+
includes:
|
24
|
+
- "\\-"
|
25
|
+
bullet_delimiter:
|
26
|
+
enabled: true
|
27
|
+
severity: error
|
28
|
+
includes:
|
29
|
+
- "\\-"
|
30
|
+
leading_line:
|
31
|
+
enabled: true
|
32
|
+
severity: warn
|
33
|
+
line_length:
|
34
|
+
enabled: false
|
35
|
+
severity: error
|
36
|
+
maximum: 72
|
37
|
+
paragraph_capitalization:
|
38
|
+
enabled: true
|
39
|
+
severity: error
|
40
|
+
phrase:
|
41
|
+
enabled: true
|
42
|
+
severity: error
|
43
|
+
excludes:
|
44
|
+
- "absolutely"
|
45
|
+
- "actually"
|
46
|
+
- "all intents and purposes"
|
47
|
+
- "along the lines"
|
48
|
+
- "at this moment in time"
|
49
|
+
- "basically"
|
50
|
+
- "each and every one"
|
51
|
+
- "everyone knows"
|
52
|
+
- "fact of the matter"
|
53
|
+
- "furthermore"
|
54
|
+
- "however"
|
55
|
+
- "in due course"
|
56
|
+
- "in the end"
|
57
|
+
- "last but not least"
|
58
|
+
- "matter of fact"
|
59
|
+
- "obviously"
|
60
|
+
- "of course"
|
61
|
+
- "really"
|
62
|
+
- "simply"
|
63
|
+
- "things being equal"
|
64
|
+
- "would like to"
|
65
|
+
- "\\beasy\\b"
|
66
|
+
- "\\bjust\\b"
|
67
|
+
- "\\bquite\\b"
|
68
|
+
- "as\\sfar\\sas\\s.+\\sconcerned"
|
69
|
+
- "of\\sthe\\s(fact|opinion)\\sthat"
|
70
|
+
presence:
|
71
|
+
enabled: true
|
72
|
+
severity: warn
|
73
|
+
minimum: 1
|
74
|
+
single_bullet:
|
75
|
+
enabled: true
|
76
|
+
severity: error
|
77
|
+
includes:
|
78
|
+
- "\\-"
|
79
|
+
tracker_shorthand:
|
80
|
+
enabled: true
|
81
|
+
severity: error
|
82
|
+
excludes:
|
83
|
+
- "(f|F)ix(es|ed)?\\s\\#\\d+"
|
84
|
+
- "(c|C)lose(s|d)?\\s\\#\\d+"
|
85
|
+
- "(r|R)esolve(s|d)?\\s\\#\\d+"
|
86
|
+
signature:
|
87
|
+
enabled: false
|
88
|
+
severity: error
|
89
|
+
includes:
|
90
|
+
- Good
|
91
|
+
subject:
|
92
|
+
length:
|
93
|
+
enabled: true
|
94
|
+
severity: error
|
95
|
+
maximum: 72
|
96
|
+
prefix:
|
97
|
+
enabled: true
|
98
|
+
severity: error
|
99
|
+
delimiter: " "
|
100
|
+
includes:
|
101
|
+
- Fixed
|
102
|
+
- Added
|
103
|
+
- Updated
|
104
|
+
- Removed
|
105
|
+
- Refactored
|
106
|
+
suffix:
|
107
|
+
enabled: true
|
108
|
+
severity: error
|
109
|
+
excludes:
|
110
|
+
- "\\."
|
111
|
+
- "\\?"
|
112
|
+
- "\\!"
|
113
|
+
trailer:
|
114
|
+
collaborator_capitalization:
|
115
|
+
enabled: true
|
116
|
+
severity: error
|
117
|
+
collaborator_email:
|
118
|
+
enabled: true
|
119
|
+
severity: error
|
120
|
+
collaborator_key:
|
121
|
+
enabled: true
|
122
|
+
severity: error
|
123
|
+
includes:
|
124
|
+
- Co-Authored-By
|
125
|
+
collaborator_name:
|
126
|
+
enabled: true
|
127
|
+
severity: error
|
128
|
+
minimum: 2
|
129
|
+
duplicate:
|
130
|
+
enabled: true
|
131
|
+
severity: error
|
132
|
+
format_key:
|
133
|
+
enabled: true
|
134
|
+
severity: error
|
135
|
+
includes:
|
136
|
+
- Format
|
137
|
+
format_value:
|
138
|
+
enabled: true
|
139
|
+
severity: error
|
140
|
+
includes:
|
141
|
+
- ASCII
|
142
|
+
- Markdown
|
143
|
+
issue_key:
|
144
|
+
enabled: true
|
145
|
+
severity: error
|
146
|
+
includes:
|
147
|
+
- Issue
|
148
|
+
issue_value:
|
149
|
+
enabled: true
|
150
|
+
severity: error
|
151
|
+
includes:
|
152
|
+
- "[\\w-]+"
|
153
|
+
signer_capitalization:
|
154
|
+
enabled: true
|
155
|
+
severity: error
|
156
|
+
signer_email:
|
157
|
+
enabled: true
|
158
|
+
severity: error
|
159
|
+
signer_key:
|
160
|
+
enabled: true
|
161
|
+
severity: error
|
162
|
+
includes:
|
163
|
+
- Signed-By
|
164
|
+
signer_name:
|
165
|
+
enabled: true
|
166
|
+
severity: error
|
167
|
+
minimum: 2
|
168
|
+
tracker_key:
|
169
|
+
enabled: true
|
170
|
+
severity: error
|
171
|
+
includes:
|
172
|
+
- Tracker
|
173
|
+
tracker_value:
|
174
|
+
enabled: true
|
175
|
+
severity: error
|
176
|
+
includes:
|
177
|
+
- "[\\w\\-\\s]+"
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Git
|
4
|
+
module Lint
|
5
|
+
module Configuration
|
6
|
+
# Defines configuration content as the primary source of truth for use throughout the gem.
|
7
|
+
Model = Data.define :commits_author_capitalization_enabled,
|
8
|
+
:commits_author_capitalization_severity,
|
9
|
+
:commits_author_email_enabled,
|
10
|
+
:commits_author_email_severity,
|
11
|
+
:commits_author_name_enabled,
|
12
|
+
:commits_author_name_severity,
|
13
|
+
:commits_author_name_minimum,
|
14
|
+
:commits_body_bullet_enabled,
|
15
|
+
:commits_body_bullet_severity,
|
16
|
+
:commits_body_bullet_excludes,
|
17
|
+
:commits_body_bullet_capitalization_enabled,
|
18
|
+
:commits_body_bullet_capitalization_severity,
|
19
|
+
:commits_body_bullet_capitalization_includes,
|
20
|
+
:commits_body_bullet_delimiter_enabled,
|
21
|
+
:commits_body_bullet_delimiter_severity,
|
22
|
+
:commits_body_bullet_delimiter_includes,
|
23
|
+
:commits_body_leading_line_enabled,
|
24
|
+
:commits_body_leading_line_severity,
|
25
|
+
:commits_body_line_length_enabled,
|
26
|
+
:commits_body_line_length_severity,
|
27
|
+
:commits_body_line_length_maximum,
|
28
|
+
:commits_body_paragraph_capitalization_enabled,
|
29
|
+
:commits_body_paragraph_capitalization_severity,
|
30
|
+
:commits_body_phrase_enabled,
|
31
|
+
:commits_body_phrase_severity,
|
32
|
+
:commits_body_phrase_excludes,
|
33
|
+
:commits_body_presence_enabled,
|
34
|
+
:commits_body_presence_severity,
|
35
|
+
:commits_body_presence_minimum,
|
36
|
+
:commits_body_single_bullet_enabled,
|
37
|
+
:commits_body_single_bullet_severity,
|
38
|
+
:commits_body_single_bullet_includes,
|
39
|
+
:commits_body_tracker_shorthand_enabled,
|
40
|
+
:commits_body_tracker_shorthand_severity,
|
41
|
+
:commits_body_tracker_shorthand_excludes,
|
42
|
+
:commits_signature_enabled,
|
43
|
+
:commits_signature_severity,
|
44
|
+
:commits_signature_includes,
|
45
|
+
:commits_subject_length_enabled,
|
46
|
+
:commits_subject_length_severity,
|
47
|
+
:commits_subject_length_maximum,
|
48
|
+
:commits_subject_prefix_enabled,
|
49
|
+
:commits_subject_prefix_severity,
|
50
|
+
:commits_subject_prefix_delimiter,
|
51
|
+
:commits_subject_prefix_includes,
|
52
|
+
:commits_subject_suffix_enabled,
|
53
|
+
:commits_subject_suffix_severity,
|
54
|
+
:commits_subject_suffix_excludes,
|
55
|
+
:commits_trailer_collaborator_capitalization_enabled,
|
56
|
+
:commits_trailer_collaborator_capitalization_severity,
|
57
|
+
:commits_trailer_collaborator_email_enabled,
|
58
|
+
:commits_trailer_collaborator_email_severity,
|
59
|
+
:commits_trailer_collaborator_key_enabled,
|
60
|
+
:commits_trailer_collaborator_key_severity,
|
61
|
+
:commits_trailer_collaborator_key_includes,
|
62
|
+
:commits_trailer_collaborator_name_enabled,
|
63
|
+
:commits_trailer_collaborator_name_severity,
|
64
|
+
:commits_trailer_collaborator_name_minimum,
|
65
|
+
:commits_trailer_duplicate_enabled,
|
66
|
+
:commits_trailer_duplicate_severity,
|
67
|
+
:commits_trailer_format_key_enabled,
|
68
|
+
:commits_trailer_format_key_severity,
|
69
|
+
:commits_trailer_format_key_includes,
|
70
|
+
:commits_trailer_format_value_enabled,
|
71
|
+
:commits_trailer_format_value_severity,
|
72
|
+
:commits_trailer_format_value_includes,
|
73
|
+
:commits_trailer_issue_key_enabled,
|
74
|
+
:commits_trailer_issue_key_severity,
|
75
|
+
:commits_trailer_issue_key_includes,
|
76
|
+
:commits_trailer_issue_value_enabled,
|
77
|
+
:commits_trailer_issue_value_severity,
|
78
|
+
:commits_trailer_issue_value_includes,
|
79
|
+
:commits_trailer_signer_capitalization_enabled,
|
80
|
+
:commits_trailer_signer_capitalization_severity,
|
81
|
+
:commits_trailer_signer_email_enabled,
|
82
|
+
:commits_trailer_signer_email_severity,
|
83
|
+
:commits_trailer_signer_key_enabled,
|
84
|
+
:commits_trailer_signer_key_severity,
|
85
|
+
:commits_trailer_signer_key_includes,
|
86
|
+
:commits_trailer_signer_name_enabled,
|
87
|
+
:commits_trailer_signer_name_severity,
|
88
|
+
:commits_trailer_signer_name_minimum,
|
89
|
+
:commits_trailer_tracker_key_enabled,
|
90
|
+
:commits_trailer_tracker_key_severity,
|
91
|
+
:commits_trailer_tracker_key_includes,
|
92
|
+
:commits_trailer_tracker_value_enabled,
|
93
|
+
:commits_trailer_tracker_value_severity,
|
94
|
+
:commits_trailer_tracker_value_includes
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
data/lib/git/lint/container.rb
CHANGED
@@ -2,23 +2,37 @@
|
|
2
2
|
|
3
3
|
require "cogger"
|
4
4
|
require "dry-container"
|
5
|
+
require "etcher"
|
5
6
|
require "gitt"
|
7
|
+
require "runcom"
|
6
8
|
require "spek"
|
7
9
|
require "tone"
|
8
10
|
|
9
11
|
module Git
|
10
12
|
module Lint
|
13
|
+
# :nocov:
|
11
14
|
# Provides a global gem container for injection into other objects.
|
12
15
|
module Container
|
13
16
|
extend Dry::Container::Mixin
|
14
17
|
|
15
|
-
register
|
18
|
+
register :configuration do
|
19
|
+
self[:defaults].add_loader(Etcher::Loaders::YAML.new(self[:xdg_config].active))
|
20
|
+
.then { |registry| Etcher.call registry }
|
21
|
+
end
|
22
|
+
|
23
|
+
register :defaults do
|
24
|
+
Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
|
25
|
+
.add_loader(Etcher::Loaders::YAML.new(self[:defaults_path]))
|
26
|
+
end
|
27
|
+
|
28
|
+
register(:color) { Tone.new }
|
16
29
|
register(:environment) { ENV }
|
17
30
|
register(:git) { Gitt::Repository.new }
|
31
|
+
register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
|
32
|
+
register(:xdg_config) { Runcom::Config.new "git-lint/configuration.yml" }
|
18
33
|
register(:specification) { Spek::Loader.call "#{__dir__}/../../../git-lint.gemspec" }
|
19
34
|
register(:kernel) { Kernel }
|
20
35
|
register(:logger) { Cogger.new formatter: :emoji }
|
21
|
-
register(:color) { Tone.new }
|
22
36
|
|
23
37
|
namespace :trailers do
|
24
38
|
register(:collaborator) { /\ACo.*Authored.*By.*\Z/i }
|
@@ -29,16 +29,16 @@ module Git
|
|
29
29
|
|
30
30
|
def severity_suffix
|
31
31
|
case analyzer.severity
|
32
|
-
when
|
33
|
-
when
|
32
|
+
when "warn" then " Warning"
|
33
|
+
when "error" then " Error"
|
34
34
|
else ""
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
def style
|
39
39
|
case analyzer.severity
|
40
|
-
when
|
41
|
-
when
|
40
|
+
when "warn" then :yellow
|
41
|
+
when "error" then :red
|
42
42
|
else :white
|
43
43
|
end
|
44
44
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|