git-lint 2.2.1 → 2.3.3
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 +20 -13
- data/lib/git/lint/analyzers/abstract.rb +9 -27
- data/lib/git/lint/analyzers/commit_author_capitalization.rb +1 -3
- data/lib/git/lint/analyzers/commit_author_email.rb +1 -3
- data/lib/git/lint/analyzers/commit_author_name.rb +1 -3
- data/lib/git/lint/analyzers/commit_body_bullet.rb +2 -6
- data/lib/git/lint/analyzers/commit_body_bullet_capitalization.rb +3 -9
- data/lib/git/lint/analyzers/commit_body_bullet_delimiter.rb +4 -12
- data/lib/git/lint/analyzers/commit_body_issue_tracker_link.rb +3 -9
- data/lib/git/lint/analyzers/commit_body_line_length.rb +3 -9
- data/lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb +3 -9
- data/lib/git/lint/analyzers/commit_body_phrase.rb +2 -6
- data/lib/git/lint/analyzers/commit_body_presence.rb +2 -4
- data/lib/git/lint/analyzers/commit_body_single_bullet.rb +3 -9
- data/lib/git/lint/analyzers/commit_subject_length.rb +2 -6
- data/lib/git/lint/analyzers/commit_subject_prefix.rb +2 -10
- data/lib/git/lint/analyzers/commit_subject_suffix.rb +1 -3
- data/lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb +1 -3
- data/lib/git/lint/analyzers/commit_trailer_collaborator_duplication.rb +1 -3
- data/lib/git/lint/analyzers/commit_trailer_collaborator_email.rb +1 -3
- data/lib/git/lint/analyzers/commit_trailer_collaborator_key.rb +2 -6
- data/lib/git/lint/analyzers/commit_trailer_collaborator_name.rb +2 -6
- data/lib/git/lint/branches/environments/circle_ci.rb +2 -6
- data/lib/git/lint/branches/environments/git_hub_action.rb +2 -6
- data/lib/git/lint/branches/environments/local.rb +2 -6
- data/lib/git/lint/branches/environments/netlify_ci.rb +1 -3
- data/lib/git/lint/branches/environments/travis_ci.rb +4 -12
- data/lib/git/lint/branches/feature.rb +1 -3
- data/lib/git/lint/cli.rb +1 -1
- data/lib/git/lint/collector.rb +10 -30
- data/lib/git/lint/identity.rb +2 -2
- data/lib/git/lint/kit/filter_list.rb +3 -9
- data/lib/git/lint/parsers/trailers/collaborator.rb +4 -12
- data/lib/git/lint/rake/tasks.rb +1 -3
- data/lib/git/lint/refinements/strings.rb +2 -6
- data/lib/git/lint/reporters/branch.rb +1 -1
- data/lib/git/lint/reporters/commit.rb +1 -3
- data/lib/git/lint/reporters/line.rb +1 -3
- data/lib/git/lint/reporters/lines/paragraph.rb +5 -15
- data/lib/git/lint/reporters/lines/sentence.rb +3 -9
- data/lib/git/lint/reporters/style.rb +1 -3
- data/lib/git/lint/validators/capitalization.rb +2 -6
- data/lib/git/lint/validators/email.rb +1 -3
- data/lib/git/lint/validators/name.rb +2 -6
- data.tar.gz.sig +0 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ba6ef01971e64eb6557ab96a40ce3d654d1e5c67a6342e914fe23aff07ada79
|
4
|
+
data.tar.gz: 539ea126e206e06212b59a86349313c3e491854d3516d7f5fc27885551caf162
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79e10c0fcc9b911744b29c978222db93e31ecb2e26a449d45ad7754c8a7cd2eb0bf39902b68689c01d434b7cc1938283ba33d1936611bdd447c62f0fa4e5dbf3
|
7
|
+
data.tar.gz: 2aa2cbd29e4c78718fe00cff4598dec1801dc8f784f8628bf13333480d9895512ab0c64841dcd01a850cfacf369d7d26f2d2ba15c27507de460323e565fa8d4f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -18,8 +18,11 @@ image::https://travis-ci.org/bkuhlmann/git-lint.svg?branch=main[Travis CI Status
|
|
18
18
|
[link=https://app.netlify.com/sites/git-lint/deploys]
|
19
19
|
image::https://api.netlify.com/api/v1/badges/7e23b422-3412-4e7f-b654-65c0417a0b1f/deploy-status[Netlify CI Status]
|
20
20
|
|
21
|
-
|
22
|
-
debuggable, and maintainable project history.
|
21
|
+
Git Lint is a command line interface for linting Git commits by ensuring you maintain a clean, easy
|
22
|
+
to read, debuggable, and maintainable project history. Having a consistent commit history leads to
|
23
|
+
improved code reviews and is a perfect companion to tools like
|
24
|
+
link:https://www.alchemists.io/projects/milestoner[Milestoner] for versioning and producing
|
25
|
+
automated release notes of your deploys.
|
23
26
|
|
24
27
|
toc::[]
|
25
28
|
|
@@ -731,12 +734,12 @@ Automatically ignores _fixup!_ or _squash!_ commit prefixes when calculating sub
|
|
731
734
|
| true | error | includes: (see below)
|
732
735
|
|===
|
733
736
|
|
734
|
-
Ensures
|
737
|
+
Ensures each commit subject uses consistent prefixes that explain _what_ is being committed. The
|
735
738
|
`includes` are _case sensitive_ and default to the following prefixes:
|
736
739
|
|
737
740
|
* *Fixed* - Identifies what was fixed. The commit should be as small as possible and consist of
|
738
|
-
changes to implementation and spec only. In some cases this might be a single line
|
739
|
-
|
741
|
+
changes to implementation and spec only. In some cases this might be a single line change. The
|
742
|
+
important point is the change is applied to existing code which corrects behavior that wasn't
|
740
743
|
properly implemented earlier.
|
741
744
|
* *Removed* - Identifies what was removed. The commit should be as small as possible and consist
|
742
745
|
only of removed lines/files from the existing implementation. This might also mean breaking
|
@@ -754,14 +757,17 @@ Ensures the commit subject uses consistent prefixes that explain _what_ is being
|
|
754
757
|
implementation behavior or corresponding specs because, if that happens, then one of the other
|
755
758
|
four prefixes is what you want to use instead.
|
756
759
|
|
757
|
-
In practice,
|
758
|
-
|
760
|
+
In practice, it is quite rare to need a prefix other than what has been detailed above to explain
|
761
|
+
_what_ is being committed. These prefixes are not only short and easy to remember but also have the
|
759
762
|
added benefit of categorizing the commits for building release notes, change logs, etc. This becomes
|
760
|
-
handy when coupled with another tool,
|
761
|
-
for producing consistent project
|
763
|
+
handy when coupled with another tool,
|
764
|
+
link:https://www.alchemists.io/projects/milestoner[Milestoner], for producing consistent project
|
765
|
+
milestones and Git tag histories. For a deeper dive on subject prefixes and good commit messages in
|
766
|
+
general, please read about link:https://www.alchemists.io/articles/git_commit_anatomy[commit anatomy
|
767
|
+
] to learn more. 🎉
|
762
768
|
|
763
|
-
|
764
|
-
disturb interactive rebase workflows.
|
769
|
+
💡 This analyzer automatically ignores _amend!_, _fixup!_, or _squash!_ commit prefixes when used as
|
770
|
+
a Git Hook in order to not disturb interactive rebase workflows.
|
765
771
|
|
766
772
|
=== Commit Subject Suffix
|
767
773
|
|
@@ -899,8 +905,9 @@ worth considering:
|
|
899
905
|
Submodules can accomplish.
|
900
906
|
* Avoid using link:https://git-lfs.github.com[Git LFS] for tracking binary artifacts/resources.
|
901
907
|
These files are not meant for version control and lead to large repositories that are time
|
902
|
-
consuming to clone/deploy. Use storage managers, like link:https://aws.amazon.com/s3[Amazon S3]
|
903
|
-
for example, that are better suited for binary assets that don't
|
908
|
+
consuming to clone/deploy. Use storage managers, like link:https://aws.amazon.com/s3[Amazon S3] or
|
909
|
+
link:https://lakefs.io[LakeFS] for example, that are better suited for binary assets that don't
|
910
|
+
change often.
|
904
911
|
|
905
912
|
=== Security
|
906
913
|
|
@@ -18,25 +18,17 @@ module Git
|
|
18
18
|
@descendants << klass unless klass.to_s.start_with? "#<Class" # Ignore anonymous classes.
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.id
|
22
|
-
to_s.delete_prefix("Git::Lint::Analyzers").snakecase.to_sym
|
23
|
-
end
|
21
|
+
def self.id = to_s.delete_prefix("Git::Lint::Analyzers").snakecase.to_sym
|
24
22
|
|
25
|
-
def self.label
|
26
|
-
to_s.delete_prefix("Git::Lint::Analyzers").titleize
|
27
|
-
end
|
23
|
+
def self.label = to_s.delete_prefix("Git::Lint::Analyzers").titleize
|
28
24
|
|
29
25
|
def self.defaults
|
30
26
|
fail NotImplementedError, "The `.#{__method__}` method must be implemented."
|
31
27
|
end
|
32
28
|
|
33
|
-
def self.descendants
|
34
|
-
@descendants || []
|
35
|
-
end
|
29
|
+
def self.descendants = @descendants || []
|
36
30
|
|
37
|
-
def self.build_issue_line index, line
|
38
|
-
{number: index + ISSUE_LINE_OFFSET, content: line}
|
39
|
-
end
|
31
|
+
def self.build_issue_line(index, line) = {number: index + ISSUE_LINE_OFFSET, content: line}
|
40
32
|
|
41
33
|
attr_reader :commit
|
42
34
|
|
@@ -46,9 +38,7 @@ module Git
|
|
46
38
|
@filter_list = load_filter_list
|
47
39
|
end
|
48
40
|
|
49
|
-
def enabled?
|
50
|
-
settings.fetch :enabled
|
51
|
-
end
|
41
|
+
def enabled? = settings.fetch(:enabled)
|
52
42
|
|
53
43
|
def severity
|
54
44
|
settings.fetch(:severity).tap do |level|
|
@@ -60,17 +50,11 @@ module Git
|
|
60
50
|
fail NotImplementedError, "The `##{__method__}` method must be implemented."
|
61
51
|
end
|
62
52
|
|
63
|
-
def invalid?
|
64
|
-
!valid?
|
65
|
-
end
|
53
|
+
def invalid? = !valid?
|
66
54
|
|
67
|
-
def warning?
|
68
|
-
invalid? && severity == :warn
|
69
|
-
end
|
55
|
+
def warning? = invalid? && severity == :warn
|
70
56
|
|
71
|
-
def error?
|
72
|
-
invalid? && severity == :error
|
73
|
-
end
|
57
|
+
def error? = invalid? && severity == :error
|
74
58
|
|
75
59
|
def issue
|
76
60
|
fail NotImplementedError, "The `##{__method__}` method must be implemented."
|
@@ -80,9 +64,7 @@ module Git
|
|
80
64
|
|
81
65
|
attr_reader :settings, :filter_list
|
82
66
|
|
83
|
-
def load_filter_list
|
84
|
-
Kit::FilterList.new settings[:list]
|
85
|
-
end
|
67
|
+
def load_filter_list = Kit::FilterList.new(settings[:list])
|
86
68
|
|
87
69
|
def affected_commit_body_lines
|
88
70
|
commit.body_lines.each.with_object([]).with_index do |(line, lines), index|
|
@@ -12,9 +12,7 @@ module Git
|
|
12
12
|
}
|
13
13
|
end
|
14
14
|
|
15
|
-
def valid?
|
16
|
-
commit.body_lines.all? { |line| !invalid_line? line }
|
17
|
-
end
|
15
|
+
def valid? = commit.body_lines.all? { |line| !invalid_line? line }
|
18
16
|
|
19
17
|
def issue
|
20
18
|
return {} if valid?
|
@@ -27,9 +25,7 @@ module Git
|
|
27
25
|
|
28
26
|
protected
|
29
27
|
|
30
|
-
def load_filter_list
|
31
|
-
Kit::FilterList.new settings.fetch :excludes
|
32
|
-
end
|
28
|
+
def load_filter_list = Kit::FilterList.new(settings.fetch(:excludes))
|
33
29
|
|
34
30
|
# :reek:FeatureEnvy
|
35
31
|
def invalid_line? line
|
@@ -12,9 +12,7 @@ module Git
|
|
12
12
|
}
|
13
13
|
end
|
14
14
|
|
15
|
-
def valid?
|
16
|
-
lowercased_bullets.size.zero?
|
17
|
-
end
|
15
|
+
def valid? = lowercased_bullets.size.zero?
|
18
16
|
|
19
17
|
def issue
|
20
18
|
return {} if valid?
|
@@ -27,9 +25,7 @@ module Git
|
|
27
25
|
|
28
26
|
protected
|
29
27
|
|
30
|
-
def load_filter_list
|
31
|
-
Kit::FilterList.new settings.fetch :includes
|
32
|
-
end
|
28
|
+
def load_filter_list = Kit::FilterList.new(settings.fetch(:includes))
|
33
29
|
|
34
30
|
def invalid_line? line
|
35
31
|
line.match?(/\A\s*#{Regexp.union filter_list.to_regexp}\s[[:lower:]]+/)
|
@@ -37,9 +33,7 @@ module Git
|
|
37
33
|
|
38
34
|
private
|
39
35
|
|
40
|
-
def lowercased_bullets
|
41
|
-
commit.body_lines.select { |line| invalid_line? line }
|
42
|
-
end
|
36
|
+
def lowercased_bullets = commit.body_lines.select { |line| invalid_line? line }
|
43
37
|
end
|
44
38
|
end
|
45
39
|
end
|
@@ -12,9 +12,7 @@ module Git
|
|
12
12
|
}
|
13
13
|
end
|
14
14
|
|
15
|
-
def valid?
|
16
|
-
commit.body_lines.none? { |line| invalid_line? line }
|
17
|
-
end
|
15
|
+
def valid? = commit.body_lines.none? { |line| invalid_line? line }
|
18
16
|
|
19
17
|
def issue
|
20
18
|
return {} if valid?
|
@@ -27,17 +25,11 @@ module Git
|
|
27
25
|
|
28
26
|
protected
|
29
27
|
|
30
|
-
def load_filter_list
|
31
|
-
Kit::FilterList.new settings.fetch :includes
|
32
|
-
end
|
28
|
+
def load_filter_list = Kit::FilterList.new(settings.fetch(:includes))
|
33
29
|
|
34
|
-
def invalid_line? line
|
35
|
-
line.match?(/\A\s*#{pattern}(?!(#{pattern}|\s)).+\Z/)
|
36
|
-
end
|
30
|
+
def invalid_line?(line) = line.match?(/\A\s*#{pattern}(?!(#{pattern}|\s)).+\Z/)
|
37
31
|
|
38
|
-
def pattern
|
39
|
-
Regexp.union filter_list.to_regexp
|
40
|
-
end
|
32
|
+
def pattern = Regexp.union(filter_list.to_regexp)
|
41
33
|
end
|
42
34
|
end
|
43
35
|
end
|
@@ -17,9 +17,7 @@ module Git
|
|
17
17
|
}
|
18
18
|
end
|
19
19
|
|
20
|
-
def valid?
|
21
|
-
commit.body_lines.none? { |line| invalid_line? line }
|
22
|
-
end
|
20
|
+
def valid? = commit.body_lines.none? { |line| invalid_line? line }
|
23
21
|
|
24
22
|
def issue
|
25
23
|
return {} if valid?
|
@@ -32,13 +30,9 @@ module Git
|
|
32
30
|
|
33
31
|
protected
|
34
32
|
|
35
|
-
def load_filter_list
|
36
|
-
Kit::FilterList.new settings.fetch :excludes
|
37
|
-
end
|
33
|
+
def load_filter_list = Kit::FilterList.new(settings.fetch(:excludes))
|
38
34
|
|
39
|
-
def invalid_line? line
|
40
|
-
line.match?(/.*#{Regexp.union filter_list.to_regexp}.*/)
|
41
|
-
end
|
35
|
+
def invalid_line?(line) = line.match?(/.*#{Regexp.union filter_list.to_regexp}.*/)
|
42
36
|
end
|
43
37
|
end
|
44
38
|
end
|
@@ -12,9 +12,7 @@ module Git
|
|
12
12
|
}
|
13
13
|
end
|
14
14
|
|
15
|
-
def valid?
|
16
|
-
commit.body_lines.all? { |line| !invalid_line? line }
|
17
|
-
end
|
15
|
+
def valid? = commit.body_lines.all? { |line| !invalid_line? line }
|
18
16
|
|
19
17
|
def issue
|
20
18
|
return {} if valid?
|
@@ -27,15 +25,11 @@ module Git
|
|
27
25
|
|
28
26
|
protected
|
29
27
|
|
30
|
-
def invalid_line? line
|
31
|
-
line.length > length
|
32
|
-
end
|
28
|
+
def invalid_line?(line) = line.length > length
|
33
29
|
|
34
30
|
private
|
35
31
|
|
36
|
-
def length
|
37
|
-
settings.fetch :length
|
38
|
-
end
|
32
|
+
def length = settings.fetch(:length)
|
39
33
|
end
|
40
34
|
end
|
41
35
|
end
|
@@ -11,13 +11,9 @@ module Git
|
|
11
11
|
}
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.invalid? line
|
15
|
-
line.match?(/\A[[:lower:]].+\Z/m)
|
16
|
-
end
|
14
|
+
def self.invalid?(line) = line.match?(/\A[[:lower:]].+\Z/m)
|
17
15
|
|
18
|
-
def valid?
|
19
|
-
lowercased_lines.empty?
|
20
|
-
end
|
16
|
+
def valid? = lowercased_lines.empty?
|
21
17
|
|
22
18
|
def issue
|
23
19
|
return {} if valid?
|
@@ -30,9 +26,7 @@ module Git
|
|
30
26
|
|
31
27
|
private
|
32
28
|
|
33
|
-
def lowercased_lines
|
34
|
-
commit.body_paragraphs.select { |line| self.class.invalid? line }
|
35
|
-
end
|
29
|
+
def lowercased_lines = commit.body_paragraphs.select { |line| self.class.invalid? line }
|
36
30
|
|
37
31
|
def affected_lines
|
38
32
|
klass = self.class
|
@@ -41,9 +41,7 @@ module Git
|
|
41
41
|
end
|
42
42
|
# rubocop:enable Metrics/MethodLength
|
43
43
|
|
44
|
-
def valid?
|
45
|
-
commit.body_lines.all? { |line| !invalid_line? line }
|
46
|
-
end
|
44
|
+
def valid? = commit.body_lines.all? { |line| !invalid_line? line }
|
47
45
|
|
48
46
|
def issue
|
49
47
|
return {} if valid?
|
@@ -56,9 +54,7 @@ module Git
|
|
56
54
|
|
57
55
|
protected
|
58
56
|
|
59
|
-
def load_filter_list
|
60
|
-
Kit::FilterList.new settings.fetch(:excludes)
|
61
|
-
end
|
57
|
+
def load_filter_list = Kit::FilterList.new(settings.fetch(:excludes))
|
62
58
|
|
63
59
|
def invalid_line? line
|
64
60
|
line.downcase.match? Regexp.new(
|
@@ -4,7 +4,7 @@ module Git
|
|
4
4
|
module Lint
|
5
5
|
module Analyzers
|
6
6
|
class CommitBodyPresence < Abstract
|
7
|
-
using Refinements::Strings
|
7
|
+
using GitPlus::Refinements::Strings
|
8
8
|
|
9
9
|
def self.defaults
|
10
10
|
{
|
@@ -21,9 +21,7 @@ module Git
|
|
21
21
|
valid_lines.size >= minimum
|
22
22
|
end
|
23
23
|
|
24
|
-
def minimum
|
25
|
-
settings.fetch :minimum
|
26
|
-
end
|
24
|
+
def minimum = settings.fetch(:minimum)
|
27
25
|
|
28
26
|
def issue
|
29
27
|
return {} if valid?
|
@@ -12,9 +12,7 @@ module Git
|
|
12
12
|
}
|
13
13
|
end
|
14
14
|
|
15
|
-
def valid?
|
16
|
-
affected_commit_body_lines.size != 1
|
17
|
-
end
|
15
|
+
def valid? = affected_commit_body_lines.size != 1
|
18
16
|
|
19
17
|
def issue
|
20
18
|
return {} if valid?
|
@@ -27,13 +25,9 @@ module Git
|
|
27
25
|
|
28
26
|
protected
|
29
27
|
|
30
|
-
def load_filter_list
|
31
|
-
Kit::FilterList.new settings.fetch :includes
|
32
|
-
end
|
28
|
+
def load_filter_list = Kit::FilterList.new(settings.fetch(:includes))
|
33
29
|
|
34
|
-
def invalid_line? line
|
35
|
-
line.match?(/\A#{Regexp.union filter_list.to_regexp}\s+/)
|
36
|
-
end
|
30
|
+
def invalid_line?(line) = line.match?(/\A#{Regexp.union filter_list.to_regexp}\s+/)
|
37
31
|
end
|
38
32
|
end
|
39
33
|
end
|
@@ -12,9 +12,7 @@ module Git
|
|
12
12
|
}
|
13
13
|
end
|
14
14
|
|
15
|
-
def valid?
|
16
|
-
commit.subject.sub(/(fixup!|squash!)\s{1}/, "").size <= length
|
17
|
-
end
|
15
|
+
def valid? = commit.subject.sub(/(fixup!|squash!)\s{1}/, "").size <= length
|
18
16
|
|
19
17
|
def issue
|
20
18
|
return {} if valid?
|
@@ -24,9 +22,7 @@ module Git
|
|
24
22
|
|
25
23
|
private
|
26
24
|
|
27
|
-
def length
|
28
|
-
settings.fetch :length
|
29
|
-
end
|
25
|
+
def length = settings.fetch(:length)
|
30
26
|
end
|
31
27
|
end
|
32
28
|
end
|
@@ -13,7 +13,7 @@ module Git
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def valid?
|
16
|
-
return true if
|
16
|
+
return true if commit.prefix?
|
17
17
|
return true if filter_list.empty?
|
18
18
|
|
19
19
|
commit.subject.match?(/\A#{Regexp.union filter_list.to_regexp}/)
|
@@ -27,15 +27,7 @@ module Git
|
|
27
27
|
|
28
28
|
protected
|
29
29
|
|
30
|
-
def load_filter_list
|
31
|
-
Kit::FilterList.new settings.fetch(:includes)
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def fixup_or_squash?
|
37
|
-
commit.fixup? || commit.squash?
|
38
|
-
end
|
30
|
+
def load_filter_list = Kit::FilterList.new(settings.fetch(:includes))
|
39
31
|
end
|
40
32
|
end
|
41
33
|
end
|
@@ -19,9 +19,7 @@ module Git
|
|
19
19
|
@parser = parser
|
20
20
|
end
|
21
21
|
|
22
|
-
def valid?
|
23
|
-
affected_commit_trailers.empty?
|
24
|
-
end
|
22
|
+
def valid? = affected_commit_trailers.empty?
|
25
23
|
|
26
24
|
def issue
|
27
25
|
return {} if valid?
|
@@ -34,9 +32,7 @@ module Git
|
|
34
32
|
|
35
33
|
protected
|
36
34
|
|
37
|
-
def load_filter_list
|
38
|
-
Kit::FilterList.new settings.fetch :includes
|
39
|
-
end
|
35
|
+
def load_filter_list = Kit::FilterList.new(settings.fetch(:includes))
|
40
36
|
|
41
37
|
def invalid_line? line
|
42
38
|
collaborator = parser.new line
|
@@ -24,9 +24,7 @@ module Git
|
|
24
24
|
end
|
25
25
|
# rubocop:enable Metrics/ParameterLists
|
26
26
|
|
27
|
-
def valid?
|
28
|
-
affected_commit_trailers.empty?
|
29
|
-
end
|
27
|
+
def valid? = affected_commit_trailers.empty?
|
30
28
|
|
31
29
|
def issue
|
32
30
|
return {} if valid?
|
@@ -48,9 +46,7 @@ module Git
|
|
48
46
|
|
49
47
|
attr_reader :parser, :validator
|
50
48
|
|
51
|
-
def minimum
|
52
|
-
settings.fetch :minimum
|
53
|
-
end
|
49
|
+
def minimum = settings.fetch(:minimum)
|
54
50
|
end
|
55
51
|
end
|
56
52
|
end
|
@@ -10,13 +10,9 @@ module Git
|
|
10
10
|
@repository = repository
|
11
11
|
end
|
12
12
|
|
13
|
-
def name
|
14
|
-
"origin/#{repository.branch_name}"
|
15
|
-
end
|
13
|
+
def name = "origin/#{repository.branch_name}"
|
16
14
|
|
17
|
-
def commits
|
18
|
-
repository.commits "origin/#{repository.branch_default}..#{name}"
|
19
|
-
end
|
15
|
+
def commits = repository.commits("origin/#{repository.branch_default}..#{name}")
|
20
16
|
|
21
17
|
private
|
22
18
|
|
@@ -10,13 +10,9 @@ module Git
|
|
10
10
|
@repository = repository
|
11
11
|
end
|
12
12
|
|
13
|
-
def name
|
14
|
-
"origin/#{repository.branch_name}"
|
15
|
-
end
|
13
|
+
def name = "origin/#{repository.branch_name}"
|
16
14
|
|
17
|
-
def commits
|
18
|
-
repository.commits "origin/#{repository.branch_default}..#{name}"
|
19
|
-
end
|
15
|
+
def commits = repository.commits("origin/#{repository.branch_default}..#{name}")
|
20
16
|
|
21
17
|
private
|
22
18
|
|
@@ -10,13 +10,9 @@ module Git
|
|
10
10
|
@repository = repository
|
11
11
|
end
|
12
12
|
|
13
|
-
def name
|
14
|
-
repository.branch_name
|
15
|
-
end
|
13
|
+
def name = repository.branch_name
|
16
14
|
|
17
|
-
def commits
|
18
|
-
repository.commits "#{repository.branch_default}..#{name}"
|
19
|
-
end
|
15
|
+
def commits = repository.commits("#{repository.branch_default}..#{name}")
|
20
16
|
|
21
17
|
private
|
22
18
|
|
@@ -14,9 +14,7 @@ module Git
|
|
14
14
|
@environment = environment
|
15
15
|
end
|
16
16
|
|
17
|
-
def name
|
18
|
-
pull_request_branch.empty? ? ci_branch : pull_request_branch
|
19
|
-
end
|
17
|
+
def name = pull_request_branch.empty? ? ci_branch : pull_request_branch
|
20
18
|
|
21
19
|
def commits
|
22
20
|
prepare_project
|
@@ -39,17 +37,11 @@ module Git
|
|
39
37
|
shell.capture3 "git fetch"
|
40
38
|
end
|
41
39
|
|
42
|
-
def ci_branch
|
43
|
-
environment["TRAVIS_BRANCH"]
|
44
|
-
end
|
40
|
+
def ci_branch = environment["TRAVIS_BRANCH"]
|
45
41
|
|
46
|
-
def pull_request_branch
|
47
|
-
environment["TRAVIS_PULL_REQUEST_BRANCH"]
|
48
|
-
end
|
42
|
+
def pull_request_branch = environment["TRAVIS_PULL_REQUEST_BRANCH"]
|
49
43
|
|
50
|
-
def pull_request_slug
|
51
|
-
environment["TRAVIS_PULL_REQUEST_SLUG"]
|
52
|
-
end
|
44
|
+
def pull_request_slug = environment["TRAVIS_PULL_REQUEST_SLUG"]
|
53
45
|
end
|
54
46
|
end
|
55
47
|
end
|
data/lib/git/lint/cli.rb
CHANGED
data/lib/git/lint/collector.rb
CHANGED
@@ -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
|
|
data/lib/git/lint/identity.rb
CHANGED
@@ -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
|
|
data/lib/git/lint/rake/tasks.rb
CHANGED
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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
|
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: 2.
|
4
|
+
version: 2.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
|
29
29
|
W2A=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2021-06
|
31
|
+
date: 2021-09-06 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.
|
39
|
+
version: '0.6'
|
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.
|
46
|
+
version: '0.6'
|
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.
|
189
|
+
rubygems_version: 3.2.27
|
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
|