git-lint 2.0.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +2 -2
  4. data/README.adoc +37 -139
  5. data/lib/git/lint/analyzers/abstract.rb +9 -27
  6. data/lib/git/lint/analyzers/commit_author_capitalization.rb +1 -3
  7. data/lib/git/lint/analyzers/commit_author_email.rb +1 -3
  8. data/lib/git/lint/analyzers/commit_author_name.rb +1 -3
  9. data/lib/git/lint/analyzers/commit_body_bullet.rb +2 -6
  10. data/lib/git/lint/analyzers/commit_body_bullet_capitalization.rb +3 -9
  11. data/lib/git/lint/analyzers/commit_body_bullet_delimiter.rb +4 -12
  12. data/lib/git/lint/analyzers/commit_body_issue_tracker_link.rb +3 -9
  13. data/lib/git/lint/analyzers/commit_body_line_length.rb +3 -9
  14. data/lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb +3 -9
  15. data/lib/git/lint/analyzers/commit_body_phrase.rb +2 -6
  16. data/lib/git/lint/analyzers/commit_body_presence.rb +2 -4
  17. data/lib/git/lint/analyzers/commit_body_single_bullet.rb +3 -9
  18. data/lib/git/lint/analyzers/commit_subject_length.rb +2 -6
  19. data/lib/git/lint/analyzers/commit_subject_prefix.rb +2 -10
  20. data/lib/git/lint/analyzers/commit_subject_suffix.rb +1 -3
  21. data/lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb +1 -3
  22. data/lib/git/lint/analyzers/commit_trailer_collaborator_duplication.rb +1 -3
  23. data/lib/git/lint/analyzers/commit_trailer_collaborator_email.rb +1 -3
  24. data/lib/git/lint/analyzers/commit_trailer_collaborator_key.rb +2 -6
  25. data/lib/git/lint/analyzers/commit_trailer_collaborator_name.rb +2 -6
  26. data/lib/git/lint/branches/environments/circle_ci.rb +2 -6
  27. data/lib/git/lint/branches/environments/git_hub_action.rb +2 -6
  28. data/lib/git/lint/branches/environments/local.rb +2 -6
  29. data/lib/git/lint/branches/environments/netlify_ci.rb +2 -4
  30. data/lib/git/lint/branches/environments/travis_ci.rb +6 -14
  31. data/lib/git/lint/branches/feature.rb +1 -3
  32. data/lib/git/lint/cli.rb +1 -4
  33. data/lib/git/lint/collector.rb +11 -31
  34. data/lib/git/lint/identity.rb +1 -1
  35. data/lib/git/lint/kit/filter_list.rb +3 -9
  36. data/lib/git/lint/parsers/trailers/collaborator.rb +4 -12
  37. data/lib/git/lint/rake/tasks.rb +1 -3
  38. data/lib/git/lint/refinements/strings.rb +2 -6
  39. data/lib/git/lint/reporters/branch.rb +1 -1
  40. data/lib/git/lint/reporters/commit.rb +1 -3
  41. data/lib/git/lint/reporters/line.rb +1 -3
  42. data/lib/git/lint/reporters/lines/paragraph.rb +5 -15
  43. data/lib/git/lint/reporters/lines/sentence.rb +3 -9
  44. data/lib/git/lint/reporters/style.rb +1 -3
  45. data/lib/git/lint/validators/capitalization.rb +2 -6
  46. data/lib/git/lint/validators/email.rb +1 -3
  47. data/lib/git/lint/validators/name.rb +2 -6
  48. metadata +15 -15
  49. metadata.gz.sig +0 -0
data/lib/git/lint/cli.rb CHANGED
@@ -71,10 +71,7 @@ module Git
71
71
 
72
72
  desc "--hook", "Add Git Hook support."
73
73
  map "--hook" => :hook
74
- method_option :commit_message,
75
- desc: "Analyze commit message.",
76
- banner: "PATH",
77
- type: :string
74
+ method_option :commit_message, desc: "Analyze commit message.", banner: "PATH", type: :string
78
75
  def hook
79
76
  if options.commit_message?
80
77
  check_commit_message options.commit_message
@@ -8,7 +8,7 @@ module Git
8
8
  using ::Refinements::Hashes
9
9
 
10
10
  def initialize
11
- @collection = Hash.with_default []
11
+ @collection = Hash.new { |default, missing_id| default[missing_id] = [] }
12
12
  end
13
13
 
14
14
  def add analyzer
@@ -16,45 +16,25 @@ module Git
16
16
  analyzer
17
17
  end
18
18
 
19
- def retrieve id
20
- collection[id]
21
- end
19
+ def retrieve(id) = collection[id]
22
20
 
23
- def empty?
24
- collection.empty?
25
- end
21
+ def empty? = collection.empty?
26
22
 
27
- def warnings?
28
- collection.values.flatten.any?(&:warning?)
29
- end
23
+ def warnings? = collection.values.flatten.any?(&:warning?)
30
24
 
31
- def errors?
32
- collection.values.flatten.any?(&:error?)
33
- end
25
+ def errors? = collection.values.flatten.any?(&:error?)
34
26
 
35
- def issues?
36
- collection.values.flatten.any?(&:invalid?)
37
- end
27
+ def issues? = collection.values.flatten.any?(&:invalid?)
38
28
 
39
- def total_warnings
40
- collection.values.flatten.count(&:warning?)
41
- end
29
+ def total_warnings = collection.values.flatten.count(&:warning?)
42
30
 
43
- def total_errors
44
- collection.values.flatten.count(&:error?)
45
- end
31
+ def total_errors = collection.values.flatten.count(&:error?)
46
32
 
47
- def total_issues
48
- collection.values.flatten.count(&:invalid?)
49
- end
33
+ def total_issues = collection.values.flatten.count(&:invalid?)
50
34
 
51
- def total_commits
52
- collection.keys.size
53
- end
35
+ def total_commits = collection.keys.size
54
36
 
55
- def to_h
56
- collection
57
- end
37
+ def to_h = collection
58
38
 
59
39
  private
60
40
 
@@ -6,7 +6,7 @@ module Git
6
6
  module Identity
7
7
  NAME = "git-lint"
8
8
  LABEL = "Git Lint"
9
- VERSION = "2.0.0"
9
+ VERSION = "2.3.1"
10
10
  VERSION_LABEL = "#{LABEL} #{VERSION}"
11
11
  end
12
12
  end
@@ -9,17 +9,11 @@ module Git
9
9
  @list = Array list
10
10
  end
11
11
 
12
- def to_hint
13
- to_regexp.map(&:inspect).join ", "
14
- end
12
+ def to_hint = to_regexp.map(&:inspect).join(", ")
15
13
 
16
- def to_regexp
17
- list.map { |item| Regexp.new item }
18
- end
14
+ def to_regexp = list.map { |item| Regexp.new item }
19
15
 
20
- def empty?
21
- list.empty?
22
- end
16
+ def empty? = list.empty?
23
17
 
24
18
  private
25
19
 
@@ -27,21 +27,13 @@ module Git
27
27
  @matches = build_matches
28
28
  end
29
29
 
30
- def key
31
- String matches["key"]
32
- end
30
+ def key = String(matches["key"])
33
31
 
34
- def name
35
- String matches["name"]
36
- end
32
+ def name = String(matches["name"])
37
33
 
38
- def email
39
- String(matches["email"]).delete_prefix("<").delete_suffix(">")
40
- end
34
+ def email = String(matches["email"]).delete_prefix("<").delete_suffix(">")
41
35
 
42
- def match?
43
- text.match? key_pattern
44
- end
36
+ def match? = text.match?(key_pattern)
45
37
 
46
38
  private
47
39
 
@@ -9,9 +9,7 @@ module Git
9
9
  class Tasks
10
10
  include ::Rake::DSL
11
11
 
12
- def self.setup
13
- new.install
14
- end
12
+ def self.setup = new.install
15
13
 
16
14
  def initialize cli: CLI
17
15
  @cli = cli
@@ -11,13 +11,9 @@ module Git
11
11
  "#{count} #{self}#{suffix}"
12
12
  end
13
13
 
14
- def fixup?
15
- match?(/\Afixup!\s/)
16
- end
14
+ def fixup? = match?(/\Afixup!\s/)
17
15
 
18
- def squash?
19
- match?(/\Asquash!\s/)
20
- end
16
+ def squash? = match?(/\Asquash!\s/)
21
17
  end
22
18
  end
23
19
  end
@@ -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
@@ -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
@@ -23,9 +23,7 @@ module Git
23
23
 
24
24
  attr_reader :data
25
25
 
26
- def content
27
- data.fetch :content
28
- end
26
+ def content = data.fetch(__method__)
29
27
  end
30
28
  end
31
29
  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
@@ -13,9 +13,7 @@ module Git
13
13
  @colorizer = colorizer
14
14
  end
15
15
 
16
- def to_s
17
- colorizer.public_send color, message
18
- end
16
+ def to_s = colorizer.public_send(color, message)
19
17
 
20
18
  private
21
19
 
@@ -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
@@ -11,9 +11,7 @@ module Git
11
11
  @pattern = pattern
12
12
  end
13
13
 
14
- def valid?
15
- String(text).match? pattern
16
- end
14
+ def valid? = String(text).match?(pattern)
17
15
 
18
16
  private
19
17
 
@@ -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: 2.0.0
4
+ version: 2.3.1
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/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
- a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
15
- NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
13
+ MIIC/jCCAeagAwIBAgIBBDANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
+ a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMTAzMTkxMjQ4MDZaFw0yMjAzMTkx
15
+ MjQ4MDZaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
16
16
  IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
17
17
  xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
18
18
  brs+KkurHnc9FnEJAbG7ebGv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OHhXFSP1crXM95vfLhLyRYod
29
+ W2A=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-12-30 00:00:00.000000000 Z
31
+ date: 2021-07-11 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: git_plus
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.1'
39
+ version: '0.5'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.1'
46
+ version: '0.5'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: pastel
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  requirements: []
189
- rubygems_version: 3.2.3
189
+ rubygems_version: 3.2.23
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: A command line interface for linting Git commits.
metadata.gz.sig CHANGED
Binary file