quiet_quality 1.2.1 → 1.2.2
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/CHANGELOG.md +11 -0
- data/lib/quiet_quality/annotators/github_stdout.rb +3 -1
- data/lib/quiet_quality/cli/arg_parser.rb +4 -0
- data/lib/quiet_quality/cli/presenter.rb +1 -1
- data/lib/quiet_quality/config/logging.rb +3 -2
- data/lib/quiet_quality/message.rb +44 -9
- data/lib/quiet_quality/tools/brakeman/parser.rb +8 -1
- data/lib/quiet_quality/tools/brakeman/runner.rb +1 -1
- data/lib/quiet_quality/tools/brakeman.rb +1 -0
- data/lib/quiet_quality/tools/haml_lint/parser.rb +2 -1
- data/lib/quiet_quality/tools/haml_lint/runner.rb +1 -1
- data/lib/quiet_quality/tools/haml_lint.rb +1 -0
- data/lib/quiet_quality/tools/markdown_lint/parser.rb +2 -1
- data/lib/quiet_quality/tools/markdown_lint/runner.rb +1 -1
- data/lib/quiet_quality/tools/markdown_lint.rb +1 -0
- data/lib/quiet_quality/tools/rspec/parser.rb +26 -2
- data/lib/quiet_quality/tools/rspec/runner.rb +1 -1
- data/lib/quiet_quality/tools/rspec.rb +1 -0
- data/lib/quiet_quality/tools/rubocop/parser.rb +6 -1
- data/lib/quiet_quality/tools/rubocop/runner.rb +1 -1
- data/lib/quiet_quality/tools/rubocop.rb +1 -0
- data/lib/quiet_quality/tools/standardrb/parser.rb +3 -0
- data/lib/quiet_quality/tools/standardrb/runner.rb +1 -1
- data/lib/quiet_quality/tools/standardrb.rb +1 -0
- data/lib/quiet_quality/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6876b975446f39615f129b4fd35f3543bb998024ea292edcac1e6e1a90f7b59b
|
4
|
+
data.tar.gz: 277492ea2e6b93854e3b7d16f0184a50b5c756683929fb2a1081415e8e9836df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d0acaa14243573095f8741b9ca45cf56608b4ffde72f3ecd36a6ebd03cb0aeb45541ef3e4dad1c681976d5cdc3226d738a489b754d80590be032c31bbc8520b
|
7
|
+
data.tar.gz: 8e8daf77522762cca13480745f30df25cb2e445f2f7c69f98c20af9bc3b03bc8568299b8403ddbbc2e09fef750d3b3944c1a6f9b8dc2e4e22a4389a5419d05ab
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Release 1.2.2
|
4
|
+
|
5
|
+
* Add some code to the Rspec::Parser that _cleans_ the json of certain text that
|
6
|
+
simplecov may write into the rspec json output. (#91, resolves #86)
|
7
|
+
* Include the name of the originating tool in the printed message, and the
|
8
|
+
annotation, when a warning is presented. (#90 resolves #72)
|
9
|
+
* Support `normal` as a logging level, and the `--normal` and `-n` cli
|
10
|
+
arguments. This is the default value, so this really only matters if your
|
11
|
+
config file sets another value and you want to override it from the cli.
|
12
|
+
(#91, resolves #86)
|
13
|
+
|
3
14
|
## Release 1.2.1
|
4
15
|
|
5
16
|
* Fix the handling of the various ways to specify whether tools should limit
|
@@ -18,10 +18,12 @@ module QuietQuality
|
|
18
18
|
# ::warning file={name},line={line},title={title}::{message}
|
19
19
|
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message
|
20
20
|
def self.format(message)
|
21
|
+
title = message.tool_name.to_s
|
22
|
+
title += " #{message.rule}" if message.rule
|
21
23
|
attributes = {
|
22
24
|
file: message.path,
|
23
25
|
line: message.annotated_line || message.start_line,
|
24
|
-
title:
|
26
|
+
title: title
|
25
27
|
}.compact
|
26
28
|
|
27
29
|
attributes_string = attributes.map { |k, v| "#{k}=#{v}" }.join(",")
|
@@ -137,6 +137,10 @@ module QuietQuality
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def setup_logging_options(parser)
|
140
|
+
parser.on("-n", "--normal", "Print outcomes and messages") do
|
141
|
+
set_global_option(:logging, Config::Logging::NORMAL)
|
142
|
+
end
|
143
|
+
|
140
144
|
parser.on("-l", "--light", "Print aggregated results only") do
|
141
145
|
set_global_option(:logging, Config::Logging::LIGHT)
|
142
146
|
end
|
@@ -70,7 +70,7 @@ module QuietQuality
|
|
70
70
|
line_range = line_range_for(msg)
|
71
71
|
rule_string = msg.rule ? " [#{msg.rule}]" : ""
|
72
72
|
truncated_body = reduce_text(msg.body, 120)
|
73
|
-
logger.puts " #{msg.path}:#{line_range}#{rule_string} #{truncated_body}"
|
73
|
+
logger.puts "#{msg.tool_name} #{msg.path}:#{line_range}#{rule_string} #{truncated_body}"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -3,11 +3,12 @@ module QuietQuality
|
|
3
3
|
class Logging
|
4
4
|
LIGHT = :light
|
5
5
|
QUIET = :quiet
|
6
|
-
|
6
|
+
NORMAL = :normal
|
7
|
+
LEVELS = [LIGHT, QUIET, NORMAL].freeze
|
7
8
|
|
8
9
|
attr_accessor :level
|
9
10
|
|
10
|
-
def initialize(level:
|
11
|
+
def initialize(level: NORMAL)
|
11
12
|
@level = level
|
12
13
|
end
|
13
14
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module QuietQuality
|
2
2
|
class Message
|
3
|
-
|
4
|
-
|
3
|
+
REQUIRED_ATTRS = %w[path body start_line tool_name].freeze
|
4
|
+
|
5
|
+
attr_writer :annotated_line
|
5
6
|
|
6
7
|
def self.load(hash)
|
7
8
|
new(**hash)
|
@@ -9,17 +10,51 @@ module QuietQuality
|
|
9
10
|
|
10
11
|
def initialize(**attrs)
|
11
12
|
@attrs = attrs.map { |k, v| [k.to_s, v] }.to_h
|
12
|
-
|
13
|
-
@body = @attrs.fetch("body")
|
14
|
-
@start_line = @attrs.fetch("start_line")
|
15
|
-
@stop_line = @attrs.fetch("stop_line", @start_line)
|
16
|
-
@annotated_line = @attrs.fetch("annotated_line", nil)
|
17
|
-
@level = @attrs.fetch("level", nil)
|
18
|
-
@rule = @attrs.fetch("rule", nil)
|
13
|
+
validate_attrs!
|
19
14
|
end
|
20
15
|
|
21
16
|
def to_h
|
22
17
|
@attrs.map { |k, v| [k.to_s, v] }.to_h
|
23
18
|
end
|
19
|
+
|
20
|
+
def path
|
21
|
+
@_path ||= @attrs.fetch("path")
|
22
|
+
end
|
23
|
+
|
24
|
+
def body
|
25
|
+
@_body ||= @attrs.fetch("body")
|
26
|
+
end
|
27
|
+
|
28
|
+
def tool_name
|
29
|
+
@_tool_name ||= @attrs.fetch("tool_name")
|
30
|
+
end
|
31
|
+
|
32
|
+
def start_line
|
33
|
+
@_start_line ||= @attrs.fetch("start_line")
|
34
|
+
end
|
35
|
+
|
36
|
+
def stop_line
|
37
|
+
@_stop_line ||= @attrs.fetch("stop_line", start_line)
|
38
|
+
end
|
39
|
+
|
40
|
+
def annotated_line
|
41
|
+
@annotated_line ||= @attrs.fetch("annotated_line", nil)
|
42
|
+
end
|
43
|
+
|
44
|
+
def level
|
45
|
+
@_level ||= @attrs.fetch("level", nil)
|
46
|
+
end
|
47
|
+
|
48
|
+
def rule
|
49
|
+
@_rule ||= @attrs.fetch("rule", nil)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def validate_attrs!
|
55
|
+
REQUIRED_ATTRS.each do |attr|
|
56
|
+
raise ArgumentError, "Missing required attribute #{attr}" unless @attrs[attr]
|
57
|
+
end
|
58
|
+
end
|
24
59
|
end
|
25
60
|
end
|
@@ -37,7 +37,14 @@ module QuietQuality
|
|
37
37
|
line = warning.fetch(:line)
|
38
38
|
level = warning.fetch(:confidence, nil)
|
39
39
|
rule = warning.fetch(:warning_type)
|
40
|
-
Message.new(
|
40
|
+
Message.new(
|
41
|
+
path: path,
|
42
|
+
body: body,
|
43
|
+
start_line: line,
|
44
|
+
level: level,
|
45
|
+
rule: rule,
|
46
|
+
tool_name: TOOL_NAME
|
47
|
+
)
|
41
48
|
end
|
42
49
|
end
|
43
50
|
end
|
@@ -36,7 +36,8 @@ module QuietQuality
|
|
36
36
|
body: offense.fetch(:message),
|
37
37
|
start_line: offense.dig(:location, :line),
|
38
38
|
level: offense.fetch(:severity, nil),
|
39
|
-
rule: offense.fetch(:linter_name, nil)
|
39
|
+
rule: offense.fetch(:linter_name, nil),
|
40
|
+
tool_name: TOOL_NAME
|
40
41
|
)
|
41
42
|
end
|
42
43
|
end
|
@@ -16,8 +16,26 @@ module QuietQuality
|
|
16
16
|
|
17
17
|
attr_reader :text
|
18
18
|
|
19
|
+
# Many people use simplecov with rspec, and its default formatter
|
20
|
+
# writes text output into the stdout stream of rspec even when rspec is
|
21
|
+
# asked for json output. I have an issue open here, and I'll get a pair
|
22
|
+
# of PRs together if they indicate any willingness to accept such a
|
23
|
+
# change: https://github.com/simplecov-ruby/simplecov/issues/1060
|
24
|
+
#
|
25
|
+
# The only stdout writes are visible on these lines:
|
26
|
+
# https://github.com/simplecov-ruby/simplecov-html/blob/main/lib/simplecov-html.rb#L31
|
27
|
+
# https://github.com/simplecov-ruby/simplecov-html/blob/main/lib/simplecov-html.rb#L80
|
28
|
+
#
|
29
|
+
# There are _hundreds_ of rspec plugins, and any of them could write to
|
30
|
+
# stdout - we probably won't worry about any but the most common.
|
31
|
+
def cleaned_text
|
32
|
+
@_cleaned_text ||= text
|
33
|
+
.gsub(/Coverage report generated.*covered.$/, "")
|
34
|
+
.gsub(/Encoding problems with file.*$/, "")
|
35
|
+
end
|
36
|
+
|
19
37
|
def content
|
20
|
-
@_content ||= JSON.parse(
|
38
|
+
@_content ||= JSON.parse(cleaned_text, symbolize_names: true)
|
21
39
|
end
|
22
40
|
|
23
41
|
def examples
|
@@ -37,7 +55,13 @@ module QuietQuality
|
|
37
55
|
body = example.dig(:exception, :message) || example.fetch(:description)
|
38
56
|
line = example.fetch(:line_number)
|
39
57
|
rule = example.dig(:exception, :class) || "Failed Example"
|
40
|
-
Message.new(
|
58
|
+
Message.new(
|
59
|
+
path: path,
|
60
|
+
body: body,
|
61
|
+
start_line: line,
|
62
|
+
rule: rule,
|
63
|
+
tool_name: TOOL_NAME
|
64
|
+
)
|
41
65
|
end
|
42
66
|
end
|
43
67
|
end
|
@@ -37,9 +37,14 @@ module QuietQuality
|
|
37
37
|
start_line: offense.dig(:location, :start_line),
|
38
38
|
stop_line: offense.dig(:location, :last_line),
|
39
39
|
level: offense.fetch(:severity, nil),
|
40
|
-
rule: offense.fetch(:cop_name, nil)
|
40
|
+
rule: offense.fetch(:cop_name, nil),
|
41
|
+
tool_name: tool_name
|
41
42
|
)
|
42
43
|
end
|
44
|
+
|
45
|
+
def tool_name
|
46
|
+
TOOL_NAME
|
47
|
+
end
|
43
48
|
end
|
44
49
|
end
|
45
50
|
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.2
|
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-06-
|
11
|
+
date: 2023-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|