git-lint 5.2.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,162 +1,177 @@
1
- :analyzers:
2
- :commit_author_capitalization:
3
- :enabled: true
4
- :severity: :error
5
- :commit_author_email:
6
- :enabled: true
7
- :severity: :error
8
- :commit_author_name:
9
- :enabled: true
10
- :severity: :error
11
- :minimum: 2
12
- :commit_body_bullet:
13
- :enabled: true
14
- :severity: :error
15
- :excludes:
16
- - "\\*"
17
- - "•"
18
- :commit_body_bullet_capitalization:
19
- :enabled: true
20
- :severity: :error
21
- :includes: "\\-"
22
- :commit_body_bullet_delimiter:
23
- :enabled: true
24
- :severity: :error
25
- :includes: "\\-"
26
- :commit_body_leading_line:
27
- :enabled: true
28
- :severity: :warn
29
- :commit_body_line_length:
30
- :enabled: false
31
- :severity: :error
32
- :maximum: 72
33
- :commit_body_paragraph_capitalization:
34
- :enabled: true
35
- :severity: :error
36
- :commit_body_phrase:
37
- :enabled: true
38
- :severity: :error
39
- :excludes:
40
- - "absolutely"
41
- - "actually"
42
- - "all intents and purposes"
43
- - "along the lines"
44
- - "at this moment in time"
45
- - "basically"
46
- - "each and every one"
47
- - "everyone knows"
48
- - "fact of the matter"
49
- - "furthermore"
50
- - "however"
51
- - "in due course"
52
- - "in the end"
53
- - "last but not least"
54
- - "matter of fact"
55
- - "obviously"
56
- - "of course"
57
- - "really"
58
- - "simply"
59
- - "things being equal"
60
- - "would like to"
61
- - "\\beasy\\b"
62
- - "\\bjust\\b"
63
- - "\\bquite\\b"
64
- - "as\\sfar\\sas\\s.+\\sconcerned"
65
- - "of\\sthe\\s(fact|opinion)\\sthat"
66
- :commit_body_presence:
67
- :enabled: true
68
- :severity: :warn
69
- :minimum: 1
70
- :commit_body_single_bullet:
71
- :enabled: true
72
- :severity: :error
73
- :includes: "\\-"
74
- :commit_body_tracker_shorthand:
75
- :enabled: true
76
- :severity: :error
77
- :excludes:
78
- - "(f|F)ix(es|ed)?\\s\\#\\d+"
79
- - "(c|C)lose(s|d)?\\s\\#\\d+"
80
- - "(r|R)esolve(s|d)?\\s\\#\\d+"
81
- :commit_signature:
82
- :enabled: false
83
- :severity: :error
84
- :includes: Good
85
- :commit_subject_length:
86
- :enabled: true
87
- :severity: :error
88
- :maximum: 72
89
- :commit_subject_prefix:
90
- :enabled: true
91
- :severity: :error
92
- :delimiter: " "
93
- :includes:
94
- - Fixed
95
- - Added
96
- - Updated
97
- - Removed
98
- - Refactored
99
- :commit_subject_suffix:
100
- :enabled: true
101
- :severity: :error
102
- :excludes:
103
- - "\\."
104
- - "\\?"
105
- - "\\!"
106
- :commit_trailer_collaborator_capitalization:
107
- :enabled: true
108
- :severity: :error
109
- :commit_trailer_collaborator_email:
110
- :enabled: true
111
- :severity: :error
112
- :commit_trailer_collaborator_key:
113
- :enabled: true
114
- :severity: :error
115
- :includes: Co-Authored-By
116
- :commit_trailer_collaborator_name:
117
- :enabled: true
118
- :severity: :error
119
- :minimum: 2
120
- :commit_trailer_duplicate:
121
- :enabled: true
122
- :severity: :error
123
- :commit_trailer_format_key:
124
- :enabled: true
125
- :severity: :error
126
- :includes: Format
127
- :commit_trailer_format_value:
128
- :enabled: true
129
- :severity: :error
130
- :includes:
131
- - ASCII
132
- - Markdown
133
- :commit_trailer_issue_key:
134
- :enabled: true
135
- :severity: :error
136
- :includes: Issue
137
- :commit_trailer_issue_value:
138
- :enabled: true
139
- :severity: :error
140
- :includes: "[\\w-]+"
141
- :commit_trailer_signer_capitalization:
142
- :enabled: true
143
- :severity: :error
144
- :commit_trailer_signer_email:
145
- :enabled: true
146
- :severity: :error
147
- :commit_trailer_signer_key:
148
- :enabled: true
149
- :severity: :error
150
- :includes: Signed-By
151
- :commit_trailer_signer_name:
152
- :enabled: true
153
- :severity: :error
154
- :minimum: 2
155
- :commit_trailer_tracker_key:
156
- :enabled: true
157
- :severity: :error
158
- :includes: Tracker
159
- :commit_trailer_tracker_value:
160
- :enabled: true
161
- :severity: :error
162
- :includes: "[\\w\\-\\s]+"
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
@@ -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(:configuration) { Configuration::Loader.call }
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
- register(:logger) { Cogger::Client.new }
21
- register(:color) { Tone.new }
35
+ register(:logger) { Cogger.new formatter: :emoji }
22
36
 
23
37
  namespace :trailers do
24
38
  register(:collaborator) { /\ACo.*Authored.*By.*\Z/i }
@@ -18,7 +18,7 @@ module Git
18
18
 
19
19
  def call
20
20
  desc "Run Git Lint"
21
- task(:git_lint) { shell.call ["--analyze"] }
21
+ task(:git_lint) { shell.call %w[analyze --branch] }
22
22
  end
23
23
 
24
24
  private
@@ -29,16 +29,16 @@ module Git
29
29
 
30
30
  def severity_suffix
31
31
  case analyzer.severity
32
- when :warn then " Warning"
33
- when :error then " Error"
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 :warn then :yellow
41
- when :error then :red
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