git-lint 5.2.0 → 6.0.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.adoc +195 -137
  4. data/git-lint.gemspec +12 -9
  5. data/lib/git/lint/analyzer.rb +9 -11
  6. data/lib/git/lint/analyzers/abstract.rb +6 -11
  7. data/lib/git/lint/analyzers/commit_author_name.rb +1 -1
  8. data/lib/git/lint/analyzers/commit_body_bullet.rb +3 -1
  9. data/lib/git/lint/analyzers/commit_body_bullet_capitalization.rb +3 -1
  10. data/lib/git/lint/analyzers/commit_body_bullet_delimiter.rb +3 -1
  11. data/lib/git/lint/analyzers/commit_body_line_length.rb +1 -1
  12. data/lib/git/lint/analyzers/commit_body_phrase.rb +3 -1
  13. data/lib/git/lint/analyzers/commit_body_presence.rb +1 -1
  14. data/lib/git/lint/analyzers/commit_body_single_bullet.rb +3 -1
  15. data/lib/git/lint/analyzers/commit_body_tracker_shorthand.rb +3 -1
  16. data/lib/git/lint/analyzers/commit_signature.rb +3 -1
  17. data/lib/git/lint/analyzers/commit_subject_length.rb +1 -1
  18. data/lib/git/lint/analyzers/commit_subject_prefix.rb +5 -3
  19. data/lib/git/lint/analyzers/commit_subject_suffix.rb +3 -1
  20. data/lib/git/lint/analyzers/commit_trailer_collaborator_key.rb +3 -1
  21. data/lib/git/lint/analyzers/commit_trailer_collaborator_name.rb +1 -1
  22. data/lib/git/lint/analyzers/commit_trailer_format_key.rb +3 -1
  23. data/lib/git/lint/analyzers/commit_trailer_format_value.rb +3 -1
  24. data/lib/git/lint/analyzers/commit_trailer_issue_key.rb +3 -1
  25. data/lib/git/lint/analyzers/commit_trailer_issue_value.rb +3 -1
  26. data/lib/git/lint/analyzers/commit_trailer_signer_key.rb +3 -1
  27. data/lib/git/lint/analyzers/commit_trailer_signer_name.rb +1 -1
  28. data/lib/git/lint/analyzers/commit_trailer_tracker_key.rb +3 -1
  29. data/lib/git/lint/analyzers/commit_trailer_tracker_value.rb +3 -1
  30. data/lib/git/lint/cli/actions/analyze/branch.rb +8 -2
  31. data/lib/git/lint/cli/actions/analyze/commit.rb +7 -1
  32. data/lib/git/lint/cli/actions/hook.rb +8 -1
  33. data/lib/git/lint/cli/shell.rb +26 -26
  34. data/lib/git/lint/configuration/contract.rb +103 -0
  35. data/lib/git/lint/configuration/defaults.yml +177 -162
  36. data/lib/git/lint/configuration/model.rb +97 -0
  37. data/lib/git/lint/container.rb +17 -3
  38. data/lib/git/lint/rake/register.rb +1 -1
  39. data/lib/git/lint/reporters/style.rb +4 -4
  40. data.tar.gz.sig +0 -0
  41. metadata +62 -27
  42. metadata.gz.sig +0 -0
  43. data/lib/git/lint/cli/actions/config.rb +0 -35
  44. data/lib/git/lint/cli/actions/container.rb +0 -23
  45. data/lib/git/lint/cli/actions/import.rb +0 -13
  46. data/lib/git/lint/cli/parser.rb +0 -37
  47. data/lib/git/lint/cli/parsers/analyze.rb +0 -41
  48. data/lib/git/lint/cli/parsers/core.rb +0 -76
  49. data/lib/git/lint/configuration/content.rb +0 -26
  50. data/lib/git/lint/configuration/loader.rb +0 -50
  51. data/lib/git/lint/configuration/setting.rb +0 -25
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: 5.2.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2023-04-10 00:00:00.000000000 Z
38
+ date: 2023-06-16 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: cogger
@@ -43,28 +43,28 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.5'
46
+ version: '0.10'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.5'
53
+ version: '0.10'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: core
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 0.1.0
60
+ version: '0.1'
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 0.1.0
67
+ version: '0.1'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: dry-container
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -93,36 +93,78 @@ dependencies:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
95
  version: '1.6'
96
+ - !ruby/object:Gem::Dependency
97
+ name: dry-schema
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '1.13'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.13'
110
+ - !ruby/object:Gem::Dependency
111
+ name: etcher
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.2'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.2'
96
124
  - !ruby/object:Gem::Dependency
97
125
  name: gitt
98
126
  requirement: !ruby/object:Gem::Requirement
99
127
  requirements:
100
128
  - - "~>"
101
129
  - !ruby/object:Gem::Version
102
- version: '1.1'
130
+ version: '2.0'
103
131
  type: :runtime
104
132
  prerelease: false
105
133
  version_requirements: !ruby/object:Gem::Requirement
106
134
  requirements:
107
135
  - - "~>"
108
136
  - !ruby/object:Gem::Version
109
- version: '1.1'
137
+ version: '2.0'
110
138
  - !ruby/object:Gem::Dependency
111
139
  name: infusible
112
140
  requirement: !ruby/object:Gem::Requirement
113
141
  requirements:
114
142
  - - "~>"
115
143
  - !ruby/object:Gem::Version
116
- version: '1.0'
144
+ version: '2.0'
117
145
  type: :runtime
118
146
  prerelease: false
119
147
  version_requirements: !ruby/object:Gem::Requirement
120
148
  requirements:
121
149
  - - "~>"
122
150
  - !ruby/object:Gem::Version
123
- version: '1.0'
151
+ version: '2.0'
124
152
  - !ruby/object:Gem::Dependency
125
153
  name: refinements
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '11.0'
159
+ type: :runtime
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '11.0'
166
+ - !ruby/object:Gem::Dependency
167
+ name: runcom
126
168
  requirement: !ruby/object:Gem::Requirement
127
169
  requirements:
128
170
  - - "~>"
@@ -136,47 +178,47 @@ dependencies:
136
178
  - !ruby/object:Gem::Version
137
179
  version: '10.0'
138
180
  - !ruby/object:Gem::Dependency
139
- name: runcom
181
+ name: sod
140
182
  requirement: !ruby/object:Gem::Requirement
141
183
  requirements:
142
184
  - - "~>"
143
185
  - !ruby/object:Gem::Version
144
- version: '9.0'
186
+ version: '0.0'
145
187
  type: :runtime
146
188
  prerelease: false
147
189
  version_requirements: !ruby/object:Gem::Requirement
148
190
  requirements:
149
191
  - - "~>"
150
192
  - !ruby/object:Gem::Version
151
- version: '9.0'
193
+ version: '0.0'
152
194
  - !ruby/object:Gem::Dependency
153
195
  name: spek
154
196
  requirement: !ruby/object:Gem::Requirement
155
197
  requirements:
156
198
  - - "~>"
157
199
  - !ruby/object:Gem::Version
158
- version: '1.0'
200
+ version: '2.0'
159
201
  type: :runtime
160
202
  prerelease: false
161
203
  version_requirements: !ruby/object:Gem::Requirement
162
204
  requirements:
163
205
  - - "~>"
164
206
  - !ruby/object:Gem::Version
165
- version: '1.0'
207
+ version: '2.0'
166
208
  - !ruby/object:Gem::Dependency
167
209
  name: tone
168
210
  requirement: !ruby/object:Gem::Requirement
169
211
  requirements:
170
212
  - - "~>"
171
213
  - !ruby/object:Gem::Version
172
- version: '0.1'
214
+ version: '0.3'
173
215
  type: :runtime
174
216
  prerelease: false
175
217
  version_requirements: !ruby/object:Gem::Requirement
176
218
  requirements:
177
219
  - - "~>"
178
220
  - !ruby/object:Gem::Version
179
- version: '0.1'
221
+ version: '0.3'
180
222
  - !ruby/object:Gem::Dependency
181
223
  name: zeitwerk
182
224
  requirement: !ruby/object:Gem::Requirement
@@ -242,13 +284,7 @@ files:
242
284
  - lib/git/lint/analyzers/commit_trailer_tracker_value.rb
243
285
  - lib/git/lint/cli/actions/analyze/branch.rb
244
286
  - lib/git/lint/cli/actions/analyze/commit.rb
245
- - lib/git/lint/cli/actions/config.rb
246
- - lib/git/lint/cli/actions/container.rb
247
287
  - lib/git/lint/cli/actions/hook.rb
248
- - lib/git/lint/cli/actions/import.rb
249
- - lib/git/lint/cli/parser.rb
250
- - lib/git/lint/cli/parsers/analyze.rb
251
- - lib/git/lint/cli/parsers/core.rb
252
288
  - lib/git/lint/cli/shell.rb
253
289
  - lib/git/lint/collector.rb
254
290
  - lib/git/lint/commits/loader.rb
@@ -258,10 +294,9 @@ files:
258
294
  - lib/git/lint/commits/systems/import.rb
259
295
  - lib/git/lint/commits/systems/local.rb
260
296
  - lib/git/lint/commits/systems/netlify_ci.rb
261
- - lib/git/lint/configuration/content.rb
297
+ - lib/git/lint/configuration/contract.rb
262
298
  - lib/git/lint/configuration/defaults.yml
263
- - lib/git/lint/configuration/loader.rb
264
- - lib/git/lint/configuration/setting.rb
299
+ - lib/git/lint/configuration/model.rb
265
300
  - lib/git/lint/container.rb
266
301
  - lib/git/lint/errors/base.rb
267
302
  - lib/git/lint/errors/severity.rb
@@ -304,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
339
  - !ruby/object:Gem::Version
305
340
  version: '0'
306
341
  requirements: []
307
- rubygems_version: 3.4.10
342
+ rubygems_version: 3.4.14
308
343
  signing_key:
309
344
  specification_version: 4
310
345
  summary: A command line interface for linting Git commits.
metadata.gz.sig CHANGED
Binary file
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Git
4
- module Lint
5
- module CLI
6
- module Actions
7
- # Handles gem configuration action.
8
- class Config
9
- include Git::Lint::Import[:kernel, :logger]
10
-
11
- def initialize(configuration: Configuration::Loader::CLIENT, **)
12
- super(**)
13
- @configuration = configuration
14
- end
15
-
16
- def call action
17
- case action
18
- when :edit then edit
19
- when :view then view
20
- else logger.error { "Invalid configuration action: #{action}." }
21
- end
22
- end
23
-
24
- private
25
-
26
- attr_reader :configuration
27
-
28
- def edit = kernel.system("$EDITOR #{configuration.current}")
29
-
30
- def view = kernel.system("cat #{configuration.current}")
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/container"
4
-
5
- module Git
6
- module Lint
7
- module CLI
8
- module Actions
9
- # Provides a single container with application and action specific dependencies.
10
- module Container
11
- extend Dry::Container::Mixin
12
-
13
- merge Git::Lint::Container
14
-
15
- register(:analyze_branch) { Analyze::Branch.new }
16
- register(:analyze_commit) { Analyze::Commit.new }
17
- register(:config) { Config.new }
18
- register(:hook) { Hook.new }
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "infusible"
4
-
5
- module Git
6
- module Lint
7
- module CLI
8
- module Actions
9
- Import = Infusible.with Container
10
- end
11
- end
12
- end
13
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "core"
4
- require "optparse"
5
-
6
- module Git
7
- module Lint
8
- module CLI
9
- # Assembles and parses all Command Line Interface (CLI) options.
10
- class Parser
11
- include Import[:configuration]
12
-
13
- CLIENT = OptionParser.new nil, 40, " "
14
- SECTIONS = [Parsers::Core, Parsers::Analyze].freeze # Order matters.
15
-
16
- def initialize(sections: SECTIONS, client: CLIENT, **)
17
- super(**)
18
- @sections = sections
19
- @client = client
20
- @configuration_duplicate = configuration.dup
21
- end
22
-
23
- def call arguments = Core::EMPTY_ARRAY
24
- sections.each { |section| section.call configuration_duplicate, client: }
25
- client.parse arguments
26
- configuration_duplicate.freeze
27
- end
28
-
29
- def to_s = client.to_s
30
-
31
- private
32
-
33
- attr_reader :sections, :client, :configuration_duplicate
34
- end
35
- end
36
- end
37
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "core"
4
- require "refinements/structs"
5
-
6
- module Git
7
- module Lint
8
- module CLI
9
- module Parsers
10
- # Handles parsing of Command Line Interface (CLI) core options.
11
- class Analyze
12
- using ::Refinements::Structs
13
-
14
- def self.call(...) = new(...).call
15
-
16
- def initialize configuration = Container[:configuration], client: Parser::CLIENT
17
- @configuration = configuration
18
- @client = client
19
- end
20
-
21
- def call arguments = ::Core::EMPTY_ARRAY
22
- client.separator "\nANALYZE OPTIONS:\n"
23
- add_sha
24
- client.parse arguments
25
- configuration
26
- end
27
-
28
- private
29
-
30
- attr_reader :configuration, :client
31
-
32
- def add_sha
33
- client.on "--sha HASH", "Analyze specific commit SHA." do |sha|
34
- configuration.merge! analyze_sha: sha
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "core"
4
- require "refinements/structs"
5
-
6
- module Git
7
- module Lint
8
- module CLI
9
- module Parsers
10
- # Handles parsing of Command Line Interface (CLI) core options.
11
- class Core
12
- include Import[:specification]
13
-
14
- using ::Refinements::Structs
15
-
16
- def self.call(...) = new(...).call
17
-
18
- def initialize(configuration = Container[:configuration], client: Parser::CLIENT, **)
19
- super(**)
20
- @configuration = configuration
21
- @client = client
22
- end
23
-
24
- def call arguments = ::Core::EMPTY_ARRAY
25
- client.banner = specification.labeled_summary
26
- client.separator "\nUSAGE:\n"
27
- collate
28
- client.parse arguments
29
- configuration
30
- end
31
-
32
- private
33
-
34
- attr_reader :configuration, :client
35
-
36
- def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
37
-
38
- def add_analyze
39
- client.on "-a", "--analyze [options]", "Analyze current branch commits." do
40
- configuration.merge! action_analyze: true
41
- end
42
- end
43
-
44
- def add_config
45
- client.on(
46
- "-c",
47
- "--config ACTION",
48
- %i[edit view],
49
- "Manage gem configuration. Actions: edit or view."
50
- ) do |action|
51
- configuration.merge! action_config: action
52
- end
53
- end
54
-
55
- def add_hook
56
- client.on "--hook PATH", "Hook for analyzing unsaved commits." do |path|
57
- configuration.merge! action_hook: Pathname(path)
58
- end
59
- end
60
-
61
- def add_version
62
- client.on "-v", "--version", "Show gem version." do
63
- configuration.merge! action_version: true
64
- end
65
- end
66
-
67
- def add_help
68
- client.on "-h", "--help", "Show this message." do
69
- configuration.merge! action_help: true
70
- end
71
- end
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,26 +0,0 @@
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
- Content = Struct.new(
8
- :action_analyze,
9
- :action_config,
10
- :action_help,
11
- :action_hook,
12
- :action_version,
13
- :analyze_sha,
14
- :analyzers,
15
- keyword_init: true
16
- ) do
17
- def initialize *arguments
18
- super
19
- freeze
20
- end
21
-
22
- def find_setting(id) = analyzers.find { |setting| setting.id == id }
23
- end
24
- end
25
- end
26
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pathname"
4
- require "refinements/hashes"
5
- require "refinements/structs"
6
- require "runcom"
7
- require "yaml"
8
-
9
- module Git
10
- module Lint
11
- module Configuration
12
- # Represents the fully assembled Command Line Interface (CLI) configuration.
13
- class Loader
14
- using ::Refinements::Hashes
15
- using ::Refinements::Structs
16
-
17
- DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
18
- CLIENT = Runcom::Config.new "git-lint/configuration.yml", defaults: DEFAULTS
19
-
20
- def self.call = new.call
21
-
22
- def self.with_defaults = new(client: DEFAULTS)
23
-
24
- def initialize content: Content.new, client: CLIENT, setting: Setting
25
- @content = content
26
- @client = client
27
- @setting = setting
28
- end
29
-
30
- def call
31
- client.to_h
32
- .then do |defaults|
33
- content.merge(
34
- **defaults.except(:analyzers).flatten_keys,
35
- analyzers: load_analyzer_settings(defaults)
36
- ).freeze
37
- end
38
- end
39
-
40
- private
41
-
42
- attr_reader :content, :client, :setting
43
-
44
- def load_analyzer_settings defaults
45
- defaults.fetch(:analyzers).map { |id, body| setting[id:, **body] }
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Git
4
- module Lint
5
- module Configuration
6
- # Defines analyzer specific settings.
7
- Setting = Struct.new(
8
- :delimiter,
9
- :enabled,
10
- :excludes,
11
- :id,
12
- :includes,
13
- :maximum,
14
- :minimum,
15
- :severity,
16
- keyword_init: true
17
- ) do
18
- def initialize *arguments
19
- super
20
- freeze
21
- end
22
- end
23
- end
24
- end
25
- end