quiet_quality 1.2.0 → 1.2.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 +4 -4
- data/.github/workflows/rspec.yml +1 -1
- data/CHANGELOG.md +11 -0
- data/lib/quiet_quality/cli/arg_parser.rb +7 -7
- data/lib/quiet_quality/cli/entrypoint.rb +0 -8
- data/lib/quiet_quality/config/finder.rb +0 -4
- data/lib/quiet_quality/config/parsed_options.rb +36 -0
- data/lib/quiet_quality/config/parser.rb +4 -8
- data/lib/quiet_quality/executors/base_executor.rb +1 -11
- data/lib/quiet_quality/version.rb +1 -1
- data/lib/quiet_quality/version_control_systems/git.rb +2 -11
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3847a8d0b996b19f34c32ac587dd1b9e51a2bedbea8e777e6b888294b16b5c0
|
4
|
+
data.tar.gz: 742080e4b9193d0d99606f00c68077229ffba805c5b93ffa75c09705e0101b18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b61e91968e6bdd4943809a336d60cf6a7feee9ab58db225a33f8268bd02efc911c3fa812e45491be1cc9f6d461a6db71308e790f1d912fac011c82cf4864e8d7
|
7
|
+
data.tar.gz: ace3273fb13dfcd04ae2432ed0cd488195789c75a27251617fc6be851bf865e4c4b689f9c3e3e83203ffb2b1ecd2be11c258405b10a3720c186b79b5e150fe3b
|
data/.github/workflows/rspec.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Release 1.2.1
|
4
|
+
|
5
|
+
* Fix the handling of the various ways to specify whether tools should limit
|
6
|
+
their targets to changed files or run against the entire repository. The
|
7
|
+
configuration systems had disagreements on what to call the options in
|
8
|
+
question, which resulted in some configuration entries being ignored. We
|
9
|
+
enforce a set of validations on reads and writes now to avoid such a problem
|
10
|
+
in the future (#89, resolves #88)
|
11
|
+
* Add coverage-checking, and then improve test coverage and remove unreferenced
|
12
|
+
code as a result. (#87)
|
13
|
+
|
3
14
|
## Release 1.2.0
|
4
15
|
|
5
16
|
* Support `--light`, `--quiet`, and `--logging LEVEL` arguments for less output
|
@@ -45,12 +45,12 @@ module QuietQuality
|
|
45
45
|
# options; if they don't, they are global options. (optparse allows an optional argument
|
46
46
|
# to a flag if the string representing it is not a 'string in all caps'. So `[FOO]` or `foo`
|
47
47
|
# would be optional, but `FOO` would be required. This helper simplifies handling those.
|
48
|
-
def read_tool_or_global_option(name
|
48
|
+
def read_tool_or_global_option(name:, into:, tool:, value:)
|
49
49
|
if tool
|
50
50
|
validate_value_from("tool", tool, Tools::AVAILABLE)
|
51
|
-
set_tool_option(tool,
|
51
|
+
set_tool_option(tool, into, value)
|
52
52
|
else
|
53
|
-
set_global_option(
|
53
|
+
set_global_option(into, value)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -114,11 +114,11 @@ module QuietQuality
|
|
114
114
|
|
115
115
|
def setup_file_target_options(parser)
|
116
116
|
parser.on("-a", "--all-files [tool]", "Use the tool(s) on all files") do |tool|
|
117
|
-
read_tool_or_global_option(:all_files, tool,
|
117
|
+
read_tool_or_global_option(name: :all_files, into: :limit_targets, tool: tool, value: false)
|
118
118
|
end
|
119
119
|
|
120
120
|
parser.on("-c", "--changed-files [tool]", "Use the tool(s) only on changed files") do |tool|
|
121
|
-
read_tool_or_global_option(:all_files, tool,
|
121
|
+
read_tool_or_global_option(name: :all_files, into: :limit_targets, tool: tool, value: true)
|
122
122
|
end
|
123
123
|
|
124
124
|
parser.on("-B", "--comparison-branch BRANCH", "Specify the branch to compare against") do |branch|
|
@@ -128,11 +128,11 @@ module QuietQuality
|
|
128
128
|
|
129
129
|
def setup_filter_messages_options(parser)
|
130
130
|
parser.on("-f", "--filter-messages [tool]", "Filter messages from tool(s) based on changed lines") do |tool|
|
131
|
-
read_tool_or_global_option(:filter_messages, tool, true)
|
131
|
+
read_tool_or_global_option(name: :filter_messages, into: :filter_messages, tool: tool, value: true)
|
132
132
|
end
|
133
133
|
|
134
134
|
parser.on("-u", "--unfiltered [tool]", "Don't filter messages from tool(s)") do |tool|
|
135
|
-
read_tool_or_global_option(:filter_messages, tool, false)
|
135
|
+
read_tool_or_global_option(name: :filter_messages, into: :filter_messages, tool: tool, value: false)
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -1,6 +1,26 @@
|
|
1
1
|
module QuietQuality
|
2
2
|
module Config
|
3
3
|
class ParsedOptions
|
4
|
+
InvalidOptionName = Class.new(Error)
|
5
|
+
|
6
|
+
GLOBAL_OPTIONS = [
|
7
|
+
:no_config,
|
8
|
+
:config_path,
|
9
|
+
:annotator,
|
10
|
+
:executor,
|
11
|
+
:comparison_branch,
|
12
|
+
:logging,
|
13
|
+
:limit_targets,
|
14
|
+
:filter_messages,
|
15
|
+
:file_filter
|
16
|
+
].to_set
|
17
|
+
|
18
|
+
TOOL_OPTIONS = [
|
19
|
+
:limit_targets,
|
20
|
+
:filter_messages,
|
21
|
+
:file_filter
|
22
|
+
].to_set
|
23
|
+
|
4
24
|
def initialize
|
5
25
|
@tools = []
|
6
26
|
@tool_options = {}
|
@@ -20,21 +40,37 @@ module QuietQuality
|
|
20
40
|
end
|
21
41
|
|
22
42
|
def set_global_option(name, value)
|
43
|
+
validate_global_option(name)
|
23
44
|
@global_options[name.to_sym] = value
|
24
45
|
end
|
25
46
|
|
26
47
|
def global_option(name)
|
48
|
+
validate_global_option(name)
|
27
49
|
@global_options.fetch(name.to_sym, nil)
|
28
50
|
end
|
29
51
|
|
30
52
|
def set_tool_option(tool, name, value)
|
53
|
+
validate_tool_option(name)
|
31
54
|
@tool_options[tool.to_sym] ||= {}
|
32
55
|
@tool_options[tool.to_sym][name.to_sym] = value
|
33
56
|
end
|
34
57
|
|
35
58
|
def tool_option(tool, name)
|
59
|
+
validate_tool_option(name)
|
36
60
|
@tool_options.dig(tool.to_sym, name.to_sym)
|
37
61
|
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def validate_global_option(name)
|
66
|
+
return if GLOBAL_OPTIONS.include?(name.to_sym)
|
67
|
+
fail(InvalidOptionName, "Option name #{name} is not a recognized global ParsedOption")
|
68
|
+
end
|
69
|
+
|
70
|
+
def validate_tool_option(name)
|
71
|
+
return if TOOL_OPTIONS.include?(name.to_sym)
|
72
|
+
fail(InvalidOptionName, "Option name #{name} is not a recognized tool ParsedOption")
|
73
|
+
end
|
38
74
|
end
|
39
75
|
end
|
40
76
|
end
|
@@ -42,8 +42,8 @@ module QuietQuality
|
|
42
42
|
read_global_option(opts, :annotator, :annotator, as: :symbol, validate_from: Annotators::ANNOTATOR_TYPES)
|
43
43
|
read_global_option(opts, :annotate, :annotator, as: :symbol, validate_from: Annotators::ANNOTATOR_TYPES)
|
44
44
|
read_global_option(opts, :comparison_branch, :comparison_branch, as: :string)
|
45
|
-
read_global_option(opts, :changed_files, :
|
46
|
-
read_global_option(opts, :all_files, :
|
45
|
+
read_global_option(opts, :changed_files, :limit_targets, as: :boolean)
|
46
|
+
read_global_option(opts, :all_files, :limit_targets, as: :reversed_boolean)
|
47
47
|
read_global_option(opts, :filter_messages, :filter_messages, as: :boolean)
|
48
48
|
read_global_option(opts, :unfiltered, :filter_messages, as: :reversed_boolean)
|
49
49
|
read_global_option(opts, :logging, :logging, as: :symbol, validate_from: Logging::LEVELS)
|
@@ -61,8 +61,8 @@ module QuietQuality
|
|
61
61
|
|
62
62
|
read_tool_option(opts, tool_name, :filter_messages, :filter_messages, as: :boolean)
|
63
63
|
read_tool_option(opts, tool_name, :unfiltered, :filter_messages, as: :reversed_boolean)
|
64
|
-
read_tool_option(opts, tool_name, :changed_files, :
|
65
|
-
read_tool_option(opts, tool_name, :all_files, :
|
64
|
+
read_tool_option(opts, tool_name, :changed_files, :limit_targets, as: :boolean)
|
65
|
+
read_tool_option(opts, tool_name, :all_files, :limit_targets, as: :reversed_boolean)
|
66
66
|
read_tool_option(opts, tool_name, :file_filter, :file_filter, as: :string)
|
67
67
|
end
|
68
68
|
|
@@ -102,8 +102,6 @@ module QuietQuality
|
|
102
102
|
when :reversed_boolean then validate_boolean(name, value)
|
103
103
|
when :symbol then validate_symbol(name, value, from: from)
|
104
104
|
when :string then validate_string(name, value)
|
105
|
-
else
|
106
|
-
fail ArgumentError, "validate_value does not handle type #{as}"
|
107
105
|
end
|
108
106
|
end
|
109
107
|
|
@@ -135,8 +133,6 @@ module QuietQuality
|
|
135
133
|
when :reversed_boolean then !value
|
136
134
|
when :string then value.to_s
|
137
135
|
when :symbol then value.to_sym
|
138
|
-
else
|
139
|
-
fail ArgumentError, "coerce_value does not handle type #{as}"
|
140
136
|
end
|
141
137
|
end
|
142
138
|
end
|
@@ -7,7 +7,7 @@ module QuietQuality
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def execute!
|
10
|
-
|
10
|
+
pipelines.none?(&:failure?)
|
11
11
|
end
|
12
12
|
|
13
13
|
def outcomes
|
@@ -39,16 +39,6 @@ module QuietQuality
|
|
39
39
|
Pipeline.new(tool_options: topts, changed_files: changed_files)
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
43
|
-
def pipeline_by_tool
|
44
|
-
@_pipeline_by_tool ||= pipelines
|
45
|
-
.map { |p| [p.tool_name, p] }
|
46
|
-
.to_h
|
47
|
-
end
|
48
|
-
|
49
|
-
def pipeline_for(tool)
|
50
|
-
pipeline_by_tool.fetch(tool.to_sym)
|
51
|
-
end
|
52
42
|
end
|
53
43
|
end
|
54
44
|
end
|
@@ -66,12 +66,6 @@ module QuietQuality
|
|
66
66
|
|
67
67
|
private
|
68
68
|
|
69
|
-
def changed_lines_for(diff)
|
70
|
-
GitDiffParser.parse(diff).flat_map do |parsed_diff|
|
71
|
-
parsed_diff.changed_line_numbers.to_set
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
69
|
def committed_changed_files(base, sha)
|
76
70
|
ChangedFiles.new(committed_changes(base, sha))
|
77
71
|
end
|
@@ -105,11 +99,8 @@ module QuietQuality
|
|
105
99
|
end
|
106
100
|
|
107
101
|
def untracked_paths
|
108
|
-
out,
|
109
|
-
unless stat.success?
|
110
|
-
warn err
|
111
|
-
fail(Error, "git ls-files failed")
|
112
|
-
end
|
102
|
+
out, _err, stat = Open3.capture3("git", "-C", path, "ls-files", "--others", "--exclude-standard")
|
103
|
+
fail(Error, "git ls-files failed") unless stat.success?
|
113
104
|
out.split
|
114
105
|
end
|
115
106
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiet_quality
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Mueller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
251
|
- !ruby/object:Gem::Version
|
252
252
|
version: '0'
|
253
253
|
requirements: []
|
254
|
-
rubygems_version: 3.
|
254
|
+
rubygems_version: 3.3.7
|
255
255
|
signing_key:
|
256
256
|
specification_version: 4
|
257
257
|
summary: A system for comparing quality tool outputs against the forward diffs
|