quiet_quality 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/quiet_quality/config/builder.rb +9 -2
- data/lib/quiet_quality/config/file_filter.rb +6 -0
- data/lib/quiet_quality/config/parsed_options.rb +2 -1
- data/lib/quiet_quality/config/parser.rb +9 -10
- data/lib/quiet_quality/logger.rb +4 -2
- data/lib/quiet_quality/tools/brakeman/parser.rb +4 -0
- data/lib/quiet_quality/tools/rspec/parser.rb +24 -1
- data/lib/quiet_quality/tools/rspec.rb +2 -0
- data/lib/quiet_quality/version.rb +1 -1
- data/quiet_quality.gemspec +3 -3
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3084fe3f419db403944af870a9ccc39cccfe046f9f01841f52872808cd38b186
|
4
|
+
data.tar.gz: bc3b18bd54ec79e6adf72c9947142050cd0a14a329d665f58290fe40b3382b27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 761966c658f578970e2d420d194d8d81a71e2d8808f95c8862366656a88e2ee3bf10e1ec8907ac21f4b4e62d799cd923ea481c7bbbd856da8a9b5c8656c3cf1e
|
7
|
+
data.tar.gz: 2a91a00a403943d7a6051dc788dae5d2a963740cfd6d543228d8dbc810a5efd2ac5bdc0d8fc9c5f6c799e97c0c81742fd17543a43b184b86e4be117365146a0c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Release 1.5.1
|
4
|
+
|
5
|
+
* Refactor ConfigParser to just parse the config into ParsedOptions, separating
|
6
|
+
the file-filter/excludes handling properly (#114)
|
7
|
+
* Update the standard/rubocop constraints (dev-only)
|
8
|
+
* Fail the pipeline when rspec encounters non-spec failures (#120 resolves #119)
|
9
|
+
* Expose error messages when brakeman encounters errors (#122 resolves #115)
|
10
|
+
|
3
11
|
## Release 1.5.0
|
4
12
|
|
5
13
|
* Update to comply with current standardrb rules, and use checkout@v4
|
@@ -84,7 +84,7 @@ module QuietQuality
|
|
84
84
|
|
85
85
|
def set_unless_nil(object, method, value)
|
86
86
|
return if value.nil?
|
87
|
-
object.send("#{method}=", value)
|
87
|
+
object.send(:"#{method}=", value)
|
88
88
|
end
|
89
89
|
|
90
90
|
# ---- update the global options -------------
|
@@ -129,7 +129,7 @@ module QuietQuality
|
|
129
129
|
options.tools.each do |tool_options|
|
130
130
|
update_tool_option(tool_options, :limit_targets)
|
131
131
|
update_tool_option(tool_options, :filter_messages)
|
132
|
-
|
132
|
+
set_unless_nil(tool_options, :file_filter, build_file_filter(tool_options.tool_name))
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
@@ -138,6 +138,13 @@ module QuietQuality
|
|
138
138
|
set_unless_nil(tool_options, option_name, apply.global_option(option_name))
|
139
139
|
set_unless_nil(tool_options, option_name, apply.tool_option(tool_name, option_name))
|
140
140
|
end
|
141
|
+
|
142
|
+
def build_file_filter(tool_name)
|
143
|
+
filter_string = apply.tool_option(tool_name, :file_filter)
|
144
|
+
excludes_strings = apply.tool_option(tool_name, :excludes)
|
145
|
+
return nil if filter_string.nil? && (excludes_strings.nil? || excludes_strings.empty?)
|
146
|
+
Config::FileFilter.new(regex: filter_string, excludes: excludes_strings)
|
147
|
+
end
|
141
148
|
end
|
142
149
|
end
|
143
150
|
end
|
@@ -8,6 +8,8 @@ module QuietQuality
|
|
8
8
|
@excludes_strings = excludes
|
9
9
|
end
|
10
10
|
|
11
|
+
attr_reader :regex_string, :excludes_strings
|
12
|
+
|
11
13
|
def regex
|
12
14
|
return nil if @regex_string.nil?
|
13
15
|
@_regex ||= Regexp.new(@regex_string)
|
@@ -33,6 +35,10 @@ module QuietQuality
|
|
33
35
|
regex_match?(s) && !excludes_match?(s)
|
34
36
|
end
|
35
37
|
|
38
|
+
def ==(other)
|
39
|
+
regex_string == other.regex_string && excludes_strings.sort == other.excludes_strings.sort
|
40
|
+
end
|
41
|
+
|
36
42
|
private
|
37
43
|
|
38
44
|
# The regex is an allow-match - if it's not supplied, treat everything as matching.
|
@@ -65,7 +65,8 @@ module QuietQuality
|
|
65
65
|
read_tool_option(opts, tool_name, :unfiltered, :filter_messages, as: :reversed_boolean)
|
66
66
|
read_tool_option(opts, tool_name, :changed_files, :limit_targets, as: :boolean)
|
67
67
|
read_tool_option(opts, tool_name, :all_files, :limit_targets, as: :reversed_boolean)
|
68
|
-
|
68
|
+
read_tool_option(opts, tool_name, :file_filter, :file_filter, as: :string)
|
69
|
+
read_tool_option(opts, tool_name, :excludes, :excludes, as: :strings)
|
69
70
|
end
|
70
71
|
|
71
72
|
def invalid!(message)
|
@@ -98,21 +99,13 @@ module QuietQuality
|
|
98
99
|
opts.set_tool_option(tool, into, coerced_value)
|
99
100
|
end
|
100
101
|
|
101
|
-
def read_file_filter(opts, tool)
|
102
|
-
parsed_regex = data.dig(tool.to_sym, :file_filter)
|
103
|
-
parsed_excludes = data.dig(tool.to_sym, :excludes)
|
104
|
-
if parsed_regex || parsed_excludes
|
105
|
-
filter = Config::FileFilter.new(regex: parsed_regex, excludes: parsed_excludes)
|
106
|
-
opts.set_tool_option(tool, :file_filter, filter)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
102
|
def validate_value(name, value, as:, from: nil)
|
111
103
|
case as
|
112
104
|
when :boolean then validate_boolean(name, value)
|
113
105
|
when :reversed_boolean then validate_boolean(name, value)
|
114
106
|
when :symbol then validate_symbol(name, value, from: from)
|
115
107
|
when :string then validate_string(name, value)
|
108
|
+
when :strings then validate_strings(name, value)
|
116
109
|
end
|
117
110
|
end
|
118
111
|
|
@@ -138,11 +131,17 @@ module QuietQuality
|
|
138
131
|
invalid!("option #{name} must not be empty") if value.empty?
|
139
132
|
end
|
140
133
|
|
134
|
+
def validate_strings(name, value)
|
135
|
+
invalid!("option #{name} must be an array") unless value.is_a?(Array)
|
136
|
+
value.each_with_index { |item, n| validate_string("#{name}[#{n}]", item) }
|
137
|
+
end
|
138
|
+
|
141
139
|
def coerce_value(value, as:)
|
142
140
|
case as
|
143
141
|
when :boolean then !!value
|
144
142
|
when :reversed_boolean then !value
|
145
143
|
when :string then value.to_s
|
144
|
+
when :strings then value.map(&:to_s)
|
146
145
|
when :symbol then value.to_sym
|
147
146
|
end
|
148
147
|
end
|
data/lib/quiet_quality/logger.rb
CHANGED
@@ -53,8 +53,10 @@ module QuietQuality
|
|
53
53
|
data_text = JSON.pretty_generate(data)
|
54
54
|
message = message + "\n" + data_text
|
55
55
|
end
|
56
|
-
|
57
|
-
|
56
|
+
message.split("\n")
|
57
|
+
.map { |line| "[#{prefix}] #{line}" }
|
58
|
+
.map { |prefixed_line| colorize(prefixed_line, message_level) }
|
59
|
+
.join("\n")
|
58
60
|
end
|
59
61
|
|
60
62
|
def colorize(s, message_level)
|
@@ -2,6 +2,8 @@ module QuietQuality
|
|
2
2
|
module Tools
|
3
3
|
module Brakeman
|
4
4
|
class Parser
|
5
|
+
include Logging
|
6
|
+
|
5
7
|
def initialize(text)
|
6
8
|
@text = text
|
7
9
|
end
|
@@ -24,6 +26,8 @@ module QuietQuality
|
|
24
26
|
def check_errors!
|
25
27
|
errors = data[:errors]
|
26
28
|
return if errors.nil? || errors.empty?
|
29
|
+
warn "Brakeman errors:"
|
30
|
+
errors.each { |error| warn " #{error}" }
|
27
31
|
fail(ParsingError, "Found #{errors.length} errors in brakeman output")
|
28
32
|
end
|
29
33
|
|
@@ -2,6 +2,8 @@ module QuietQuality
|
|
2
2
|
module Tools
|
3
3
|
module Rspec
|
4
4
|
class Parser
|
5
|
+
include Logging
|
6
|
+
|
5
7
|
def initialize(text)
|
6
8
|
@text = text
|
7
9
|
end
|
@@ -39,7 +41,9 @@ module QuietQuality
|
|
39
41
|
end
|
40
42
|
|
41
43
|
def examples
|
42
|
-
@_examples
|
44
|
+
return @_examples if defined?(@_examples)
|
45
|
+
raise_if_errors_outside_of_examples!
|
46
|
+
@_examples = content.fetch(:examples)
|
43
47
|
end
|
44
48
|
|
45
49
|
def failed_examples
|
@@ -63,6 +67,25 @@ module QuietQuality
|
|
63
67
|
tool_name: TOOL_NAME
|
64
68
|
)
|
65
69
|
end
|
70
|
+
|
71
|
+
def errors_count
|
72
|
+
@_errors_count ||= content.dig(:summary, :errors_outside_of_examples_count) || 0
|
73
|
+
end
|
74
|
+
|
75
|
+
def error_messages
|
76
|
+
@_error_messages ||= content.fetch(:messages, [])
|
77
|
+
end
|
78
|
+
|
79
|
+
def raise_if_errors_outside_of_examples!
|
80
|
+
return if errors_count < 1
|
81
|
+
warn "RSpec errors:"
|
82
|
+
warn "-" * 80
|
83
|
+
error_messages.each do |msg|
|
84
|
+
warn msg
|
85
|
+
warn "-" * 80
|
86
|
+
end
|
87
|
+
fail Rspec::Error, "Rspec encountered #{errors_count} errors outside of examples"
|
88
|
+
end
|
66
89
|
end
|
67
90
|
end
|
68
91
|
end
|
data/quiet_quality.gemspec
CHANGED
@@ -34,12 +34,12 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency "git", "~> 1.18"
|
35
35
|
spec.add_dependency "git_diff_parser", "~> 4"
|
36
36
|
|
37
|
-
spec.add_development_dependency "rspec", "~> 3.
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
38
38
|
spec.add_development_dependency "rspec-its", "~> 1.3"
|
39
39
|
spec.add_development_dependency "simplecov", "~> 0.22.0"
|
40
40
|
spec.add_development_dependency "pry", "~> 0.14"
|
41
|
-
spec.add_development_dependency "standard", "
|
42
|
-
spec.add_development_dependency "rubocop", "
|
41
|
+
spec.add_development_dependency "standard", ">= 1.35.1"
|
42
|
+
spec.add_development_dependency "rubocop", ">= 1.62"
|
43
43
|
spec.add_development_dependency "debug", "~> 1.7"
|
44
44
|
spec.add_development_dependency "mdl", "~> 0.12"
|
45
45
|
spec.add_development_dependency "rspec-cover_it", "~> 0.1.0"
|
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.5.
|
4
|
+
version: 1.5.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:
|
11
|
+
date: 2024-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.13'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.13'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec-its
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,30 +98,30 @@ dependencies:
|
|
98
98
|
name: standard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 1.35.1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 1.35.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubocop
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '1.
|
117
|
+
version: '1.62'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '1.
|
124
|
+
version: '1.62'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: debug
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|