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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +195 -137
- data/git-lint.gemspec +12 -9
- data/lib/git/lint/analyzer.rb +9 -11
- data/lib/git/lint/analyzers/abstract.rb +6 -11
- data/lib/git/lint/analyzers/commit_author_name.rb +1 -1
- data/lib/git/lint/analyzers/commit_body_bullet.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_bullet_capitalization.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_bullet_delimiter.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_line_length.rb +1 -1
- data/lib/git/lint/analyzers/commit_body_phrase.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_presence.rb +1 -1
- data/lib/git/lint/analyzers/commit_body_single_bullet.rb +3 -1
- data/lib/git/lint/analyzers/commit_body_tracker_shorthand.rb +3 -1
- data/lib/git/lint/analyzers/commit_signature.rb +3 -1
- data/lib/git/lint/analyzers/commit_subject_length.rb +1 -1
- data/lib/git/lint/analyzers/commit_subject_prefix.rb +5 -3
- data/lib/git/lint/analyzers/commit_subject_suffix.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_collaborator_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_collaborator_name.rb +1 -1
- data/lib/git/lint/analyzers/commit_trailer_format_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_format_value.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_issue_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_issue_value.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_signer_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_signer_name.rb +1 -1
- data/lib/git/lint/analyzers/commit_trailer_tracker_key.rb +3 -1
- data/lib/git/lint/analyzers/commit_trailer_tracker_value.rb +3 -1
- data/lib/git/lint/cli/actions/analyze/branch.rb +8 -2
- data/lib/git/lint/cli/actions/analyze/commit.rb +7 -1
- data/lib/git/lint/cli/actions/hook.rb +8 -1
- data/lib/git/lint/cli/shell.rb +26 -26
- data/lib/git/lint/configuration/contract.rb +103 -0
- data/lib/git/lint/configuration/defaults.yml +177 -162
- data/lib/git/lint/configuration/model.rb +97 -0
- data/lib/git/lint/container.rb +17 -3
- data/lib/git/lint/rake/register.rb +1 -1
- data/lib/git/lint/reporters/style.rb +4 -4
- data.tar.gz.sig +0 -0
- metadata +62 -27
- metadata.gz.sig +0 -0
- data/lib/git/lint/cli/actions/config.rb +0 -35
- data/lib/git/lint/cli/actions/container.rb +0 -23
- data/lib/git/lint/cli/actions/import.rb +0 -13
- data/lib/git/lint/cli/parser.rb +0 -37
- data/lib/git/lint/cli/parsers/analyze.rb +0 -41
- data/lib/git/lint/cli/parsers/core.rb +0 -76
- data/lib/git/lint/configuration/content.rb +0 -26
- data/lib/git/lint/configuration/loader.rb +0 -50
- data/lib/git/lint/configuration/setting.rb +0 -25
@@ -20,7 +20,9 @@ module Git
|
|
20
20
|
|
21
21
|
protected
|
22
22
|
|
23
|
-
def load_filter_list
|
23
|
+
def load_filter_list
|
24
|
+
Kit::FilterList.new configuration.commits_trailer_collaborator_key_includes
|
25
|
+
end
|
24
26
|
|
25
27
|
def invalid_line? trailer
|
26
28
|
trailer.key.then do |key|
|
@@ -20,7 +20,9 @@ module Git
|
|
20
20
|
|
21
21
|
protected
|
22
22
|
|
23
|
-
def load_filter_list
|
23
|
+
def load_filter_list
|
24
|
+
Kit::FilterList.new configuration.commits_trailer_format_key_includes
|
25
|
+
end
|
24
26
|
|
25
27
|
def invalid_line? trailer
|
26
28
|
trailer.key.then do |key|
|
@@ -20,7 +20,9 @@ module Git
|
|
20
20
|
|
21
21
|
protected
|
22
22
|
|
23
|
-
def load_filter_list
|
23
|
+
def load_filter_list
|
24
|
+
Kit::FilterList.new configuration.commits_trailer_format_value_includes
|
25
|
+
end
|
24
26
|
|
25
27
|
def invalid_line? trailer
|
26
28
|
trailer.key.match?(pattern) && !trailer.value.match?(value_pattern)
|
@@ -20,7 +20,9 @@ module Git
|
|
20
20
|
|
21
21
|
protected
|
22
22
|
|
23
|
-
def load_filter_list
|
23
|
+
def load_filter_list
|
24
|
+
Kit::FilterList.new configuration.commits_trailer_issue_key_includes
|
25
|
+
end
|
24
26
|
|
25
27
|
def invalid_line? trailer
|
26
28
|
trailer.key.then do |key|
|
@@ -20,7 +20,9 @@ module Git
|
|
20
20
|
|
21
21
|
protected
|
22
22
|
|
23
|
-
def load_filter_list
|
23
|
+
def load_filter_list
|
24
|
+
Kit::FilterList.new configuration.commits_trailer_issue_value_includes
|
25
|
+
end
|
24
26
|
|
25
27
|
def invalid_line? trailer
|
26
28
|
trailer.key.match?(pattern) && !trailer.value.match?(value_pattern)
|
@@ -20,7 +20,9 @@ module Git
|
|
20
20
|
|
21
21
|
protected
|
22
22
|
|
23
|
-
def load_filter_list
|
23
|
+
def load_filter_list
|
24
|
+
Kit::FilterList.new configuration.commits_trailer_signer_key_includes
|
25
|
+
end
|
24
26
|
|
25
27
|
def invalid_line? trailer
|
26
28
|
trailer.key.then do |key|
|
@@ -20,7 +20,9 @@ module Git
|
|
20
20
|
|
21
21
|
protected
|
22
22
|
|
23
|
-
def load_filter_list
|
23
|
+
def load_filter_list
|
24
|
+
Kit::FilterList.new configuration.commits_trailer_tracker_key_includes
|
25
|
+
end
|
24
26
|
|
25
27
|
def invalid_line? trailer
|
26
28
|
trailer.key.then do |key|
|
@@ -20,7 +20,9 @@ module Git
|
|
20
20
|
|
21
21
|
protected
|
22
22
|
|
23
|
-
def load_filter_list
|
23
|
+
def load_filter_list
|
24
|
+
Kit::FilterList.new configuration.commits_trailer_tracker_value_includes
|
25
|
+
end
|
24
26
|
|
25
27
|
def invalid_line? trailer
|
26
28
|
trailer.key.match?(pattern) && !trailer.value.match?(value_pattern)
|
@@ -1,20 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "sod"
|
4
|
+
|
3
5
|
module Git
|
4
6
|
module Lint
|
5
7
|
module CLI
|
6
8
|
module Actions
|
7
9
|
module Analyze
|
8
10
|
# Handles analyze action for branch.
|
9
|
-
class Branch
|
11
|
+
class Branch < Sod::Action
|
10
12
|
include Git::Lint::Import[:kernel, :logger]
|
11
13
|
|
14
|
+
description "Analyze current branch."
|
15
|
+
|
16
|
+
on %w[-b --branch]
|
17
|
+
|
12
18
|
def initialize(analyzer: Analyzer.new, **)
|
13
19
|
super(**)
|
14
20
|
@analyzer = analyzer
|
15
21
|
end
|
16
22
|
|
17
|
-
def call
|
23
|
+
def call(*)
|
18
24
|
parse
|
19
25
|
rescue Errors::Base => error
|
20
26
|
logger.error { error.message }
|
@@ -1,14 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "sod"
|
4
|
+
|
3
5
|
module Git
|
4
6
|
module Lint
|
5
7
|
module CLI
|
6
8
|
module Actions
|
7
9
|
module Analyze
|
8
10
|
# Handles analyze action for single commit SHA
|
9
|
-
class Commit
|
11
|
+
class Commit < Sod::Action
|
10
12
|
include Git::Lint::Import[:git, :kernel, :logger]
|
11
13
|
|
14
|
+
description "Analyze specific commits."
|
15
|
+
|
16
|
+
on %w[-c --commit], argument: "a,b,c"
|
17
|
+
|
12
18
|
def initialize(analyzer: Analyzer.new, **)
|
13
19
|
super(**)
|
14
20
|
@analyzer = analyzer
|
@@ -1,13 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "sod"
|
4
|
+
require "sod/types/pathname"
|
5
|
+
|
3
6
|
module Git
|
4
7
|
module Lint
|
5
8
|
module CLI
|
6
9
|
module Actions
|
7
10
|
# Handles unsaved Git commit action.
|
8
|
-
class Hook
|
11
|
+
class Hook < Sod::Action
|
9
12
|
include Git::Lint::Import[:git, :kernel, :logger]
|
10
13
|
|
14
|
+
description "Hook for analyzing unsaved commits."
|
15
|
+
|
16
|
+
on "--hook", argument: "PATH", type: Pathname
|
17
|
+
|
11
18
|
def initialize(analyzer: Analyzer.new, **)
|
12
19
|
super(**)
|
13
20
|
@analyzer = analyzer
|
data/lib/git/lint/cli/shell.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "sod"
|
4
4
|
|
5
5
|
module Git
|
6
6
|
module Lint
|
7
7
|
module CLI
|
8
8
|
# The main Command Line Interface (CLI) object.
|
9
9
|
class Shell
|
10
|
-
include
|
11
|
-
|
12
|
-
|
13
|
-
:config,
|
14
|
-
:hook,
|
15
|
-
:specification,
|
16
|
-
:logger
|
17
|
-
]
|
18
|
-
|
19
|
-
def initialize(parser: Parser.new, **)
|
10
|
+
include Import[:defaults_path, :xdg_config, :specification]
|
11
|
+
|
12
|
+
def initialize(context: Sod::Context, dsl: Sod, **)
|
20
13
|
super(**)
|
21
|
-
@
|
14
|
+
@context = context
|
15
|
+
@dsl = dsl
|
22
16
|
end
|
23
17
|
|
24
|
-
def call
|
25
|
-
act_on parser.call(arguments)
|
26
|
-
rescue OptionParser::ParseError, Errors::Base => error
|
27
|
-
logger.error { error.message }
|
28
|
-
end
|
18
|
+
def call(...) = cli.call(...)
|
29
19
|
|
30
20
|
private
|
31
21
|
|
32
|
-
attr_reader :
|
22
|
+
attr_reader :context, :dsl
|
23
|
+
|
24
|
+
def cli
|
25
|
+
context = build_context
|
26
|
+
|
27
|
+
dsl.new "git-lint", banner: specification.banner do
|
28
|
+
on(Sod::Prefabs::Commands::Config, context:)
|
33
29
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
30
|
+
on "analyze", "Analyze branch or commit(s)." do
|
31
|
+
on Actions::Analyze::Branch
|
32
|
+
on Actions::Analyze::Commit
|
33
|
+
end
|
34
|
+
|
35
|
+
on Actions::Hook
|
36
|
+
on(Sod::Prefabs::Actions::Version, context:)
|
37
|
+
on Sod::Prefabs::Actions::Help, self
|
42
38
|
end
|
43
39
|
end
|
40
|
+
|
41
|
+
def build_context
|
42
|
+
context[defaults_path:, xdg_config:, version_label: specification.labeled_version]
|
43
|
+
end
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/schema"
|
4
|
+
require "etcher"
|
5
|
+
|
6
|
+
Dry::Schema.load_extensions :monads
|
7
|
+
|
8
|
+
module Git
|
9
|
+
module Lint
|
10
|
+
module Configuration
|
11
|
+
Contract = Dry::Schema.Params do
|
12
|
+
required(:commits_author_capitalization_enabled).filled :bool
|
13
|
+
required(:commits_author_capitalization_severity).filled :string
|
14
|
+
required(:commits_author_email_enabled).filled :bool
|
15
|
+
required(:commits_author_email_severity).filled :string
|
16
|
+
required(:commits_author_name_enabled).filled :bool
|
17
|
+
required(:commits_author_name_severity).filled :string
|
18
|
+
required(:commits_author_name_minimum).filled :integer
|
19
|
+
required(:commits_body_bullet_enabled).filled :bool
|
20
|
+
required(:commits_body_bullet_severity).filled :string
|
21
|
+
required(:commits_body_bullet_excludes).array :string
|
22
|
+
required(:commits_body_bullet_capitalization_enabled).filled :bool
|
23
|
+
required(:commits_body_bullet_capitalization_severity).filled :string
|
24
|
+
required(:commits_body_bullet_capitalization_includes).array :string
|
25
|
+
required(:commits_body_bullet_delimiter_enabled).filled :bool
|
26
|
+
required(:commits_body_bullet_delimiter_severity).filled :string
|
27
|
+
required(:commits_body_bullet_delimiter_includes).array :string
|
28
|
+
required(:commits_body_leading_line_enabled).filled :bool
|
29
|
+
required(:commits_body_leading_line_severity).filled :string
|
30
|
+
required(:commits_body_line_length_enabled).filled :bool
|
31
|
+
required(:commits_body_line_length_severity).filled :string
|
32
|
+
required(:commits_body_line_length_maximum).filled :integer
|
33
|
+
required(:commits_body_paragraph_capitalization_enabled).filled :bool
|
34
|
+
required(:commits_body_paragraph_capitalization_severity).filled :string
|
35
|
+
required(:commits_body_phrase_enabled).filled :bool
|
36
|
+
required(:commits_body_phrase_severity).filled :string
|
37
|
+
required(:commits_body_phrase_excludes).array :string
|
38
|
+
required(:commits_body_presence_enabled).filled :bool
|
39
|
+
required(:commits_body_presence_severity).filled :string
|
40
|
+
required(:commits_body_presence_minimum).filled :integer
|
41
|
+
required(:commits_body_single_bullet_enabled).filled :bool
|
42
|
+
required(:commits_body_single_bullet_severity).filled :string
|
43
|
+
required(:commits_body_single_bullet_includes).array :string
|
44
|
+
required(:commits_body_tracker_shorthand_enabled).filled :bool
|
45
|
+
required(:commits_body_tracker_shorthand_severity).filled :string
|
46
|
+
required(:commits_body_tracker_shorthand_excludes).array :string
|
47
|
+
required(:commits_signature_enabled).filled :bool
|
48
|
+
required(:commits_signature_severity).filled :string
|
49
|
+
required(:commits_signature_includes).array :string
|
50
|
+
required(:commits_subject_length_enabled).filled :bool
|
51
|
+
required(:commits_subject_length_severity).filled :string
|
52
|
+
required(:commits_subject_length_maximum).filled :integer
|
53
|
+
required(:commits_subject_prefix_enabled).filled :bool
|
54
|
+
required(:commits_subject_prefix_severity).filled :string
|
55
|
+
required(:commits_subject_prefix_delimiter).filled :string
|
56
|
+
required(:commits_subject_prefix_includes).array :string
|
57
|
+
required(:commits_subject_suffix_enabled).filled :bool
|
58
|
+
required(:commits_subject_suffix_severity).filled :string
|
59
|
+
required(:commits_subject_suffix_excludes).array :string
|
60
|
+
required(:commits_trailer_collaborator_capitalization_enabled).filled :bool
|
61
|
+
required(:commits_trailer_collaborator_capitalization_severity).filled :string
|
62
|
+
required(:commits_trailer_collaborator_email_enabled).filled :bool
|
63
|
+
required(:commits_trailer_collaborator_email_severity).filled :string
|
64
|
+
required(:commits_trailer_collaborator_key_enabled).filled :bool
|
65
|
+
required(:commits_trailer_collaborator_key_severity).filled :string
|
66
|
+
required(:commits_trailer_collaborator_key_includes).array :string
|
67
|
+
required(:commits_trailer_collaborator_name_enabled).filled :bool
|
68
|
+
required(:commits_trailer_collaborator_name_severity).filled :string
|
69
|
+
required(:commits_trailer_collaborator_name_minimum).filled :integer
|
70
|
+
required(:commits_trailer_duplicate_enabled).filled :bool
|
71
|
+
required(:commits_trailer_duplicate_severity).filled :string
|
72
|
+
required(:commits_trailer_format_key_enabled).filled :bool
|
73
|
+
required(:commits_trailer_format_key_severity).filled :string
|
74
|
+
required(:commits_trailer_format_key_includes).array :string
|
75
|
+
required(:commits_trailer_format_value_enabled).filled :bool
|
76
|
+
required(:commits_trailer_format_value_severity).filled :string
|
77
|
+
required(:commits_trailer_format_value_includes).array :string
|
78
|
+
required(:commits_trailer_issue_key_enabled).filled :bool
|
79
|
+
required(:commits_trailer_issue_key_severity).filled :string
|
80
|
+
required(:commits_trailer_issue_key_includes).array :string
|
81
|
+
required(:commits_trailer_issue_value_enabled).filled :bool
|
82
|
+
required(:commits_trailer_issue_value_severity).filled :string
|
83
|
+
required(:commits_trailer_issue_value_includes).array :string
|
84
|
+
required(:commits_trailer_signer_capitalization_enabled).filled :bool
|
85
|
+
required(:commits_trailer_signer_capitalization_severity).filled :string
|
86
|
+
required(:commits_trailer_signer_email_enabled).filled :bool
|
87
|
+
required(:commits_trailer_signer_email_severity).filled :string
|
88
|
+
required(:commits_trailer_signer_key_enabled).filled :bool
|
89
|
+
required(:commits_trailer_signer_key_severity).filled :string
|
90
|
+
required(:commits_trailer_signer_key_includes).array :string
|
91
|
+
required(:commits_trailer_signer_name_enabled).filled :bool
|
92
|
+
required(:commits_trailer_signer_name_severity).filled :string
|
93
|
+
required(:commits_trailer_signer_name_minimum).filled :integer
|
94
|
+
required(:commits_trailer_tracker_key_enabled).filled :bool
|
95
|
+
required(:commits_trailer_tracker_key_severity).filled :string
|
96
|
+
required(:commits_trailer_tracker_key_includes).array :string
|
97
|
+
required(:commits_trailer_tracker_value_enabled).filled :bool
|
98
|
+
required(:commits_trailer_tracker_value_severity).filled :string
|
99
|
+
required(:commits_trailer_tracker_value_includes).array :string
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|