git-lint 10.3.0 → 11.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0579e354abdcbf74f13138b3380d58268cfe02847d140a798bb76ac91fbd6fbf'
4
- data.tar.gz: 1da76b63c393d595dfcc3ff01115bf1f36d51393b34469858bb29aed2cecfec3
3
+ metadata.gz: 1a398440d3a796edbf3a4b4d1e93feb848e5ce64b5e7ba5cfdc88125232467f5
4
+ data.tar.gz: 1ffb61ebc1605e237c633325b11421c508e06419e0c93ffa89a7820592177f39
5
5
  SHA512:
6
- metadata.gz: c913dfcd75ba482a13fada4abadbbc05f2a532300bd4f3447ac8afe101e7eeeda5c4f721cdfe9f4018fe2982bf74de462b42736c8c65661ae348e7e3b2a44e6f
7
- data.tar.gz: 7d2a6722730e23745716ae618d306a8931dc3361c7b58f389eb721b4ba15d1369c76514505723eebcb572f949ef8ac0b3b0e2ad5d860cec7adc44fea58603a9c
6
+ metadata.gz: 4bc2132df51e741c9c4b6486d66dc15e3e6939404d0131af907f3c7a4300bed0f649e9afe7ef0a3d38f4576736c0eb74ab2d166340ff9a652f4e6ea3a084fb5e
7
+ data.tar.gz: 6971baf71e978c16005c37b02bc7ff3550e5177b4b630919ae3df7938775d8e5c518ff1107f1aa3c49def405cae42d043a1c150ce886d8585beb9ca568096613
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -142,6 +142,9 @@ commits:
142
142
  paragraph_capitalization:
143
143
  enabled: true
144
144
  severity: error
145
+ paragraph_new_line:
146
+ enabled: true
147
+ severity: error
145
148
  phrase:
146
149
  enabled: true
147
150
  severity: error
@@ -228,6 +231,11 @@ commits:
228
231
  collaborator_email:
229
232
  enabled: true
230
233
  severity: error
234
+ excludes:
235
+ - "agent@"
236
+ - "codex@"
237
+ - "copilot@"
238
+ - "noreply"
231
239
  collaborator_key:
232
240
  enabled: true
233
241
  severity: error
@@ -258,6 +266,7 @@ commits:
258
266
  milestone_key:
259
267
  enabled: true
260
268
  severity: error
269
+ mandatory: true
261
270
  milestone_value:
262
271
  enabled: true
263
272
  severity: error
@@ -525,6 +534,26 @@ Curabitur eleifend wisi iaculis ipsum.
525
534
  * link:https://docs.asciidoctor.org/asciidoc/latest/macros/links[Links]
526
535
  * link:https://docs.asciidoctor.org/asciidoc/latest/macros/xref[Cross references]
527
536
 
537
+ ==== Commit Body Paragraph New Line
538
+
539
+ [options="header"]
540
+ |===
541
+ | Enabled | Severity | Defaults
542
+ | true | error | none
543
+ |===
544
+
545
+ Ensures each paragraph of the commit body doesn't use excessive new lines. This allows paragraphs to grow/shrink based on screen size for improved readability.
546
+
547
+ ....
548
+ # Disallowed
549
+ Pellentque morbi-trist sentus et netus
550
+ et malesuada fames ac turpis egestas.
551
+ Vestibulum tortor quam.
552
+
553
+ # Allowed
554
+ Pellentque morbi-trist sentus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam.
555
+ ....
556
+
528
557
  ==== Commit Body Phrase
529
558
 
530
559
  [options="header"]
@@ -561,7 +590,7 @@ and provides the missing spec to ensure this doesn't happen again.
561
590
  Ensures a minimum number of lines are present within the commit body. Lines with empty characters
562
591
  (i.e. whitespace, carriage returns, etc.) are considered to be empty.
563
592
 
564
- Automatically ignores _fixup!_ commits as they are not meant to have bodies.
593
+ Automatically ignores _fixup!_ directives because they are not meant to have bodies.
565
594
 
566
595
  ==== Commit Body Tracker Shorthand
567
596
 
@@ -646,7 +675,7 @@ Added documentation
646
675
  Added documentation
647
676
  ....
648
677
 
649
- Automatically ignores _amend!_, _fixup!_, or _squash!_ commit prefixes.
678
+ Automatically ignores _amend!_, _fixup!_, and _squash!_ directives.
650
679
 
651
680
  ==== Commit Subject Length
652
681
 
@@ -661,7 +690,7 @@ lenient than the link:http://tbaggery.com/2008/04/19/a-note-about-git-commit-mes
661
690
  rule] as it gives one the ability to formulate a more descriptive subject line without being too
662
691
  wordy or suffer being word wrapped.
663
692
 
664
- Automatically ignores _fixup!_ or _squash!_ commit prefixes when calculating subject length.
693
+ Automatically ignores _amend!_, _fixup!_, and _squash!_ directives.
665
694
 
666
695
  ==== Commit Subject Prefix
667
696
 
@@ -708,8 +737,7 @@ Each prefix is delimited by a space which is the default setting but can be cust
708
737
  Whatever you choose for a delimiter will not affect Git's special bang prefixes as described in the
709
738
  tip below.
710
739
 
711
- 💡 This analyzer automatically ignores _amend!_, _fixup!_, or _squash!_ commit prefixes when used as
712
- a Git Hook in order to not disturb interactive rebase workflows.
740
+ Automatically ignores _amend!_, _fixup!_, and _squash!_ directives.
713
741
 
714
742
  ==== Commit Subject Suffix
715
743
 
@@ -765,7 +793,7 @@ Shepherd Derrial Book
765
793
  [options="header"]
766
794
  |===
767
795
  | Enabled | Severity | Defaults
768
- | true | error | none
796
+ | true | error | excludes: (see configuration)
769
797
  |===
770
798
 
771
799
  Ensures collaborator email address is valid for commit trailer.
@@ -774,6 +802,9 @@ Ensures collaborator email address is valid for commit trailer.
774
802
  # Disallowed
775
803
  Co-authored-by: River Tam <invalid>
776
804
 
805
+ # Disallowed
806
+ Co-authored-by: LLM <agent@slopware.io>
807
+
777
808
  # Allowed
778
809
  Co-authored-by: River Tam <river@firefly.com>
779
810
  ....
@@ -910,13 +941,15 @@ Issue: 123
910
941
 
911
942
  [options="header"]
912
943
  |===
913
- | Enabled | Severity
914
- | true | error
944
+ | Enabled | Severity | Manditory
945
+ | true | error | true
915
946
  |===
916
947
 
917
- Ensures milestone trailer key is correct format.
948
+ Ensures milestone trailer key is present and in correct format.
918
949
 
919
950
  ....
951
+ # Disallowed (missing)
952
+
920
953
  # Disallowed
921
954
  milestone: patch
922
955
 
@@ -924,6 +957,10 @@ milestone: patch
924
957
  Milestone: patch
925
958
  ....
926
959
 
960
+ This key is mandatory by default which means the key must always be present unless the repository is unpublished (i.e. has no origin). When the repository is unpublished, this gives you the freedom to release your initial version (i.e. 0.0.0) without this trailer. Once published, you'll need the trailer. To make the key optional, set mandatory to `false`.
961
+
962
+ Automatically ignores _amend!_, _fixup!_, and _squash!_ directives.
963
+
927
964
  ==== Commit Trailer Milestone Value
928
965
 
929
966
  [options="header"]
data/git-lint.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "git-lint"
5
- spec.version = "10.3.0"
5
+ spec.version = "11.0.1"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/git-lint"
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "dry-monads", "~> 1.9"
31
31
  spec.add_dependency "dry-schema", "~> 1.15"
32
32
  spec.add_dependency "etcher", "~> 4.3"
33
- spec.add_dependency "gitt", "~> 5.0"
33
+ spec.add_dependency "gitt", "~> 5.3"
34
34
  spec.add_dependency "infusible", "~> 5.0"
35
35
  spec.add_dependency "refinements", "~> 14.0"
36
36
  spec.add_dependency "runcom", "~> 13.0"
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Git
4
+ module Lint
5
+ module Analyzers
6
+ # Analyzes proper capitalization of commit body paragraphs.
7
+ class CommitBodyParagraphNewLine < Abstract
8
+ PATTERN = /
9
+ \n # New line.
10
+ (?! # Negative lookahead start.
11
+ \s{1,} # Indentation.
12
+ | # Or.
13
+ \s* # Optional whitespace.
14
+ \# # Comment character.
15
+ ) # Negative lookahead end.
16
+ /mx
17
+
18
+ def initialize(commit, pattern: PATTERN, **)
19
+ super(commit, **)
20
+ @pattern = pattern
21
+ end
22
+
23
+ def valid? = invalids.empty?
24
+
25
+ def issue
26
+ return {} if valid?
27
+
28
+ {
29
+ hint: "Avoid unnecessary new lines.",
30
+ lines: affected_lines
31
+ }
32
+ end
33
+
34
+ private
35
+
36
+ attr_reader :pattern
37
+
38
+ def affected_lines
39
+ invalids.each.with_object [] do |line, lines|
40
+ lines << self.class.build_issue_line(commit.body_lines.index(line[/.+/]), line)
41
+ end
42
+ end
43
+
44
+ def invalids
45
+ @invalids ||= commit.body_paragraphs.grep pattern
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -17,15 +17,23 @@ module Git
17
17
  return {} if valid?
18
18
 
19
19
  {
20
- hint: %(Email must follow name and use format: "<name@server.domain>".),
20
+ hint: %(Use format: "<name@server.domain>". Avoid: #{filter_list.to_usage}.),
21
21
  lines: affected_commit_trailers
22
22
  }
23
23
  end
24
24
 
25
25
  protected
26
26
 
27
+ def load_filter_list
28
+ Kit::FilterList.new settings.commits_trailer_collaborator_email_excludes
29
+ end
30
+
27
31
  def invalid_line? trailer
28
- email = parser.call(trailer.value).email
32
+ value = trailer.value
33
+
34
+ return true if value.match?(/.*#{Regexp.union filter_list}.*/)
35
+
36
+ email = parser.call(value).email
29
37
  trailer.key.match?(setting.pattern) && !validator.call(email)
30
38
  end
31
39
 
@@ -5,15 +5,15 @@ module Git
5
5
  module Analyzers
6
6
  # Analyzes commit trailer milestone key usage.
7
7
  class CommitTrailerMilestoneKey < Abstract
8
- include Dependencies[setting: "trailers.milestone"]
8
+ include Dependencies[:git, setting: "trailers.milestone"]
9
9
 
10
- def valid? = affected_commit_trailers.empty?
10
+ def valid? = !mandatory? && affected_commit_trailers.empty?
11
11
 
12
12
  def issue
13
13
  return {} if valid?
14
14
 
15
15
  {
16
- hint: "Use: #{filter_list.to_usage}.",
16
+ hint: "#{hint_prefix}: #{filter_list.to_usage}.",
17
17
  lines: affected_commit_trailers
18
18
  }
19
19
  end
@@ -27,6 +27,20 @@ module Git
27
27
  key.match?(setting.pattern) && !key.match?(/\A#{Regexp.union filter_list}\Z/)
28
28
  end
29
29
  end
30
+
31
+ private
32
+
33
+ def mandatory?
34
+ return false if commit.directive?
35
+
36
+ missing = commit.trailers.none? { it.key == setting.name }
37
+
38
+ settings.commits_trailer_milestone_key_mandatory && git.origin? && missing
39
+ end
40
+
41
+ def hint_prefix
42
+ settings.commits_trailer_milestone_key_mandatory ? "Use (manditory)" : "Use"
43
+ end
30
44
  end
31
45
  end
32
46
  end
@@ -20,6 +20,7 @@ module Git
20
20
  Analyzers::CommitBodyLeadingLine,
21
21
  Analyzers::CommitBodyLineLength,
22
22
  Analyzers::CommitBodyParagraphCapitalization,
23
+ Analyzers::CommitBodyParagraphNewLine,
23
24
  Analyzers::CommitBodyPhrase,
24
25
  Analyzers::CommitBodyPresence,
25
26
  Analyzers::CommitBodyTrackerShorthand,
@@ -32,6 +32,8 @@ module Git
32
32
  required(:commits_body_line_length_maximum).filled :integer
33
33
  required(:commits_body_paragraph_capitalization_enabled).filled :bool
34
34
  required(:commits_body_paragraph_capitalization_severity).filled :string
35
+ required(:commits_body_paragraph_new_line_enabled).filled :bool
36
+ required(:commits_body_paragraph_new_line_severity).filled :string
35
37
  required(:commits_body_phrase_enabled).filled :bool
36
38
  required(:commits_body_phrase_severity).filled :string
37
39
  required(:commits_body_phrase_excludes).array :string
@@ -64,6 +66,7 @@ module Git
64
66
  required(:commits_trailer_collaborator_capitalization_severity).filled :string
65
67
  required(:commits_trailer_collaborator_email_enabled).filled :bool
66
68
  required(:commits_trailer_collaborator_email_severity).filled :string
69
+ required(:commits_trailer_collaborator_email_excludes).array :string
67
70
  required(:commits_trailer_collaborator_key_enabled).filled :bool
68
71
  required(:commits_trailer_collaborator_key_severity).filled :string
69
72
  required(:commits_trailer_collaborator_name_enabled).filled :bool
@@ -83,6 +86,7 @@ module Git
83
86
  required(:commits_trailer_issue_value_includes).array :string
84
87
  required(:commits_trailer_milestone_key_enabled).filled :bool
85
88
  required(:commits_trailer_milestone_key_severity).filled :string
89
+ required(:commits_trailer_milestone_key_mandatory).filled :bool
86
90
  required(:commits_trailer_milestone_value_enabled).filled :bool
87
91
  required(:commits_trailer_milestone_value_severity).filled :string
88
92
  required(:commits_trailer_milestone_value_includes).array :string
@@ -39,6 +39,9 @@ commits:
39
39
  paragraph_capitalization:
40
40
  enabled: true
41
41
  severity: error
42
+ paragraph_new_line:
43
+ enabled: true
44
+ severity: error
42
45
  phrase:
43
46
  enabled: true
44
47
  severity: error
@@ -125,6 +128,11 @@ commits:
125
128
  collaborator_email:
126
129
  enabled: true
127
130
  severity: error
131
+ excludes:
132
+ - "agent@"
133
+ - "codex@"
134
+ - "copilot@"
135
+ - "noreply"
128
136
  collaborator_key:
129
137
  enabled: true
130
138
  severity: error
@@ -155,6 +163,7 @@ commits:
155
163
  milestone_key:
156
164
  enabled: true
157
165
  severity: error
166
+ mandatory: true
158
167
  milestone_value:
159
168
  enabled: true
160
169
  severity: error
@@ -27,6 +27,8 @@ module Git
27
27
  :commits_body_line_length_maximum,
28
28
  :commits_body_paragraph_capitalization_enabled,
29
29
  :commits_body_paragraph_capitalization_severity,
30
+ :commits_body_paragraph_new_line_enabled,
31
+ :commits_body_paragraph_new_line_severity,
30
32
  :commits_body_phrase_enabled,
31
33
  :commits_body_phrase_severity,
32
34
  :commits_body_phrase_excludes,
@@ -59,6 +61,7 @@ module Git
59
61
  :commits_trailer_collaborator_capitalization_severity,
60
62
  :commits_trailer_collaborator_email_enabled,
61
63
  :commits_trailer_collaborator_email_severity,
64
+ :commits_trailer_collaborator_email_excludes,
62
65
  :commits_trailer_collaborator_key_enabled,
63
66
  :commits_trailer_collaborator_key_severity,
64
67
  :commits_trailer_collaborator_name_enabled,
@@ -78,6 +81,7 @@ module Git
78
81
  :commits_trailer_issue_value_includes,
79
82
  :commits_trailer_milestone_key_enabled,
80
83
  :commits_trailer_milestone_key_severity,
84
+ :commits_trailer_milestone_key_mandatory,
81
85
  :commits_trailer_milestone_value_enabled,
82
86
  :commits_trailer_milestone_value_severity,
83
87
  :commits_trailer_milestone_value_includes,
data.tar.gz.sig CHANGED
Binary file
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: 10.3.0
4
+ version: 11.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -125,14 +125,14 @@ dependencies:
125
125
  requirements:
126
126
  - - "~>"
127
127
  - !ruby/object:Gem::Version
128
- version: '5.0'
128
+ version: '5.3'
129
129
  type: :runtime
130
130
  prerelease: false
131
131
  version_requirements: !ruby/object:Gem::Requirement
132
132
  requirements:
133
133
  - - "~>"
134
134
  - !ruby/object:Gem::Version
135
- version: '5.0'
135
+ version: '5.3'
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: infusible
138
138
  requirement: !ruby/object:Gem::Requirement
@@ -256,6 +256,7 @@ files:
256
256
  - lib/git/lint/analyzers/commit_body_leading_line.rb
257
257
  - lib/git/lint/analyzers/commit_body_line_length.rb
258
258
  - lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb
259
+ - lib/git/lint/analyzers/commit_body_paragraph_new_line.rb
259
260
  - lib/git/lint/analyzers/commit_body_phrase.rb
260
261
  - lib/git/lint/analyzers/commit_body_presence.rb
261
262
  - lib/git/lint/analyzers/commit_body_tracker_shorthand.rb
@@ -346,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
346
347
  - !ruby/object:Gem::Version
347
348
  version: '0'
348
349
  requirements: []
349
- rubygems_version: 4.0.12
350
+ rubygems_version: 4.0.13
350
351
  specification_version: 4
351
352
  summary: A command line interface for linting Git commits.
352
353
  test_files: []
metadata.gz.sig CHANGED
Binary file