quality_gate 0.2.2 → 0.3.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
- data/CHANGELOG.md +22 -0
- data/README.md +292 -21
- data/docs/codex.md +37 -9
- data/docs/releasing.md +16 -4
- data/lib/generators/quality_gate/install/install_generator.rb +18 -3
- data/lib/generators/quality_gate/install/templates/agents_section.md.tt +13 -2
- data/lib/generators/quality_gate/install/templates/codex_fast.rb.tt +36 -0
- data/lib/generators/quality_gate/install/templates/codex_hooks.json.tt +1 -0
- data/lib/generators/quality_gate/install/templates/codex_verify_stop.rb.tt +28 -0
- data/lib/generators/quality_gate/install/templates/quality_gate.yml.tt +6 -0
- data/lib/generators/quality_gate/install/templates/quality_gate_fast.rb.tt +16 -3
- data/lib/generators/quality_gate/install/templates/quality_gate_workflow.yml.tt +28 -0
- data/lib/generators/quality_gate/install/templates/rails_quality_gate.yml.tt +45 -0
- data/lib/generators/quality_gate/install/templates/ruby_agents_section.md.tt +13 -2
- data/lib/generators/quality_gate/install/templates/ruby_quality_gate.yml.tt +5 -0
- data/lib/generators/quality_gate/install/templates/simplecov.rb.tt +1 -0
- data/lib/quality_gate/adapters/bundler_audit.rb +28 -3
- data/lib/quality_gate/adapters/database_consistency.rb +51 -0
- data/lib/quality_gate/adapters/database_consistency_report.rb +61 -0
- data/lib/quality_gate/adapters/database_consistency_report_item.rb +122 -0
- data/lib/quality_gate/adapters/debride.rb +67 -0
- data/lib/quality_gate/adapters/debride_report.rb +80 -0
- data/lib/quality_gate/adapters/herb.rb +303 -0
- data/lib/quality_gate/adapters/reek.rb +21 -2
- data/lib/quality_gate/adapters/rubocop.rb +23 -9
- data/lib/quality_gate/adapters/rubycritic.rb +74 -0
- data/lib/quality_gate/adapters/rubycritic_report.rb +112 -0
- data/lib/quality_gate/adapters/test_suite.rb +12 -1
- data/lib/quality_gate/baseline.rb +269 -0
- data/lib/quality_gate/baseline_run.rb +80 -0
- data/lib/quality_gate/cli.rb +129 -6
- data/lib/quality_gate/codex_fast_hook.rb +163 -0
- data/lib/quality_gate/codex_patch_files.rb +95 -0
- data/lib/quality_gate/codex_stop_hook.rb +102 -0
- data/lib/quality_gate/config.rb +20 -6
- data/lib/quality_gate/database_consistency_runner.rb +124 -0
- data/lib/quality_gate/doctor.rb +217 -0
- data/lib/quality_gate/doctor_bounded_file.rb +74 -0
- data/lib/quality_gate/doctor_command.rb +130 -0
- data/lib/quality_gate/doctor_coverage.rb +113 -0
- data/lib/quality_gate/doctor_git.rb +121 -0
- data/lib/quality_gate/doctor_hooks.rb +99 -0
- data/lib/quality_gate/doctor_launchers.rb +300 -0
- data/lib/quality_gate/doctor_path_lookup.rb +52 -0
- data/lib/quality_gate/doctor_report.rb +38 -0
- data/lib/quality_gate/init_command.rb +3 -1
- data/lib/quality_gate/installation.rb +72 -17
- data/lib/quality_gate/installer.rb +3 -0
- data/lib/quality_gate/reporters/doctor.rb +57 -0
- data/lib/quality_gate/reporters/json.rb +18 -1
- data/lib/quality_gate/reporters/markdown.rb +11 -1
- data/lib/quality_gate/reporters/text.rb +14 -6
- data/lib/quality_gate/ruby_profile.rb +121 -2
- data/lib/quality_gate/runner.rb +15 -17
- data/lib/quality_gate/version.rb +1 -1
- data/lib/quality_gate.rb +15 -0
- data/sig/quality_gate.rbs +117 -2
- metadata +30 -1
data/sig/quality_gate.rbs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
module QualityGate
|
|
2
|
+
interface _BaselineMatch
|
|
3
|
+
def findings: () -> Array[Finding]
|
|
4
|
+
def accepted: () -> Array[Finding]
|
|
5
|
+
end
|
|
6
|
+
|
|
2
7
|
VERSION: String
|
|
3
8
|
|
|
4
9
|
interface _Output
|
|
@@ -8,6 +13,22 @@ module QualityGate
|
|
|
8
13
|
class Error < StandardError
|
|
9
14
|
end
|
|
10
15
|
|
|
16
|
+
class BaselineError < Error
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Baseline
|
|
20
|
+
def self.capture: (gate: String, tools: Array[String], findings: Array[Finding], root: String) -> Baseline
|
|
21
|
+
def self.read: (String path) -> Baseline
|
|
22
|
+
def self.from_h: (Hash[String, untyped] document) -> Baseline
|
|
23
|
+
|
|
24
|
+
def initialize: (gate: String, tools: Array[String], entries: Array[Hash[String, untyped]]) -> void
|
|
25
|
+
def validate_context!: (gate: String, tools: Array[String]) -> Baseline
|
|
26
|
+
def match: (Array[Finding] findings, root: String) -> _BaselineMatch
|
|
27
|
+
def write: (String path, create: bool) -> Integer
|
|
28
|
+
def count: () -> Integer
|
|
29
|
+
def to_h: () -> Hash[String, untyped]
|
|
30
|
+
end
|
|
31
|
+
|
|
11
32
|
class ParseError < Error
|
|
12
33
|
attr_reader tool: String
|
|
13
34
|
|
|
@@ -33,6 +54,7 @@ module QualityGate
|
|
|
33
54
|
def create_initializers: () -> void
|
|
34
55
|
def inject_coverage: () -> void
|
|
35
56
|
def create_agent_integration: () -> void
|
|
57
|
+
def create_ci_workflow: () -> void
|
|
36
58
|
def print_summary: () -> void
|
|
37
59
|
end
|
|
38
60
|
|
|
@@ -51,6 +73,18 @@ module QualityGate
|
|
|
51
73
|
def template_for: (String name) -> String
|
|
52
74
|
end
|
|
53
75
|
|
|
76
|
+
class RailsProfile
|
|
77
|
+
attr_reader destination_root: String
|
|
78
|
+
attr_reader framework: String
|
|
79
|
+
attr_reader test_helper: String
|
|
80
|
+
attr_reader test_command: Array[String]
|
|
81
|
+
|
|
82
|
+
def initialize: (destination_root: String, ?options: Hash[Symbol, untyped]) -> void
|
|
83
|
+
def coverage?: () -> bool
|
|
84
|
+
def missing_default_helper?: () -> bool
|
|
85
|
+
def template_for: (String name) -> String
|
|
86
|
+
end
|
|
87
|
+
|
|
54
88
|
class Config
|
|
55
89
|
DEFAULTS: Hash[Symbol, untyped]
|
|
56
90
|
|
|
@@ -85,6 +119,10 @@ module QualityGate
|
|
|
85
119
|
def timeout: () -> Integer
|
|
86
120
|
end
|
|
87
121
|
|
|
122
|
+
class DatabaseConsistencyRunner
|
|
123
|
+
def self.run: (?stdout: _Output, ?stderr: _Output, ?cwd: String) -> (0 | 2)
|
|
124
|
+
end
|
|
125
|
+
|
|
88
126
|
module Adapters
|
|
89
127
|
class Brakeman < Adapter
|
|
90
128
|
CONFIDENCE_MAP: Hash[String, finding_severity]
|
|
@@ -108,6 +146,24 @@ module QualityGate
|
|
|
108
146
|
def timeout: () -> Integer
|
|
109
147
|
end
|
|
110
148
|
|
|
149
|
+
class DatabaseConsistency < Adapter
|
|
150
|
+
TOOL_NAME: String
|
|
151
|
+
BRIDGE_PATH: String
|
|
152
|
+
|
|
153
|
+
def call: () -> Array[Finding]
|
|
154
|
+
def name: () -> String
|
|
155
|
+
def command: () -> Array[String]
|
|
156
|
+
def parse: (String stdout) -> Array[Finding]
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
class Herb < Adapter
|
|
160
|
+
def initialize: (config: Config, ?files: Array[String], ?diagnostic_io: _Output) -> void
|
|
161
|
+
def call: () -> Array[Finding]
|
|
162
|
+
def name: () -> String
|
|
163
|
+
def command: () -> Array[String]
|
|
164
|
+
def parse: (String stdout) -> Array[Finding]
|
|
165
|
+
end
|
|
166
|
+
|
|
111
167
|
class RuboCop < Adapter
|
|
112
168
|
SEVERITY_MAP: Hash[String, finding_severity]
|
|
113
169
|
CONFIG_PATH: String
|
|
@@ -120,6 +176,24 @@ module QualityGate
|
|
|
120
176
|
def timeout: () -> Integer
|
|
121
177
|
end
|
|
122
178
|
|
|
179
|
+
class RubyCritic < Adapter
|
|
180
|
+
def initialize: (config: Config, ?files: Array[String], ?diagnostic_io: _Output) -> void
|
|
181
|
+
def call: () -> Array[Finding]
|
|
182
|
+
def name: () -> String
|
|
183
|
+
def command: () -> Array[String]
|
|
184
|
+
def parse: (String json) -> Array[Finding]
|
|
185
|
+
def timeout: () -> Integer
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
class Debride < Adapter
|
|
189
|
+
def initialize: (config: Config, ?files: Array[String], ?diagnostic_io: _Output) -> void
|
|
190
|
+
def call: () -> Array[Finding]
|
|
191
|
+
def name: () -> String
|
|
192
|
+
def command: () -> Array[String]
|
|
193
|
+
def parse: (String json) -> Array[Finding]
|
|
194
|
+
def timeout: () -> Integer
|
|
195
|
+
end
|
|
196
|
+
|
|
123
197
|
class SimpleCov < Adapter
|
|
124
198
|
COVERAGE_PATH: String
|
|
125
199
|
|
|
@@ -162,9 +236,10 @@ module QualityGate
|
|
|
162
236
|
attr_reader findings: Array[Finding]
|
|
163
237
|
attr_reader failed_tools: Array[String]
|
|
164
238
|
attr_reader checks: Array[Hash[Symbol, untyped]]
|
|
239
|
+
attr_reader baseline: Hash[Symbol, untyped]?
|
|
165
240
|
|
|
166
|
-
def initialize: (findings: Array[Finding], ?checks: Array[Hash[Symbol, untyped]]) -> void
|
|
167
|
-
def with: (?findings: Array[Finding], ?checks: Array[Hash[Symbol, untyped]]) -> Result
|
|
241
|
+
def initialize: (findings: Array[Finding], ?checks: Array[Hash[Symbol, untyped]], ?baseline: Hash[Symbol, untyped]?) -> void
|
|
242
|
+
def with: (?findings: Array[Finding], ?checks: Array[Hash[Symbol, untyped]], ?baseline: Hash[Symbol, untyped]?) -> Result
|
|
168
243
|
def exit_code: () -> (0 | 1 | 2)
|
|
169
244
|
end
|
|
170
245
|
end
|
|
@@ -175,6 +250,41 @@ module QualityGate
|
|
|
175
250
|
def self.run: (Array[String] argv, ?stdout: _Output, ?stderr: _Output, ?dir: String) -> (0 | 1 | 2)
|
|
176
251
|
end
|
|
177
252
|
|
|
253
|
+
class CodexStopHook
|
|
254
|
+
def initialize: (dir: String) -> void
|
|
255
|
+
def call: (untyped input) -> Hash[String, String]
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
class CodexFastHook
|
|
259
|
+
def initialize: (dir: String) -> void
|
|
260
|
+
def call: (untyped input) -> Hash[String, untyped]
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
class CodexPatchFiles
|
|
264
|
+
def self.parse: (String patch) -> Array[String]
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
class Doctor
|
|
268
|
+
def initialize: (dir: String, registry: Hash[String, untyped]) -> void
|
|
269
|
+
def call: () -> DoctorReport
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
class DoctorReport
|
|
273
|
+
STATUSES: Array[String]
|
|
274
|
+
|
|
275
|
+
attr_reader checks: Array[Hash[String, String]]
|
|
276
|
+
attr_reader summary: Hash[String, Integer]
|
|
277
|
+
|
|
278
|
+
def self.check: (id: String, status: String, message: String) -> Hash[String, String]
|
|
279
|
+
def initialize: (checks: Array[Hash[String, String]]) -> void
|
|
280
|
+
def exit_code: () -> (0 | 1 | 2)
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
class DoctorCommand
|
|
284
|
+
def initialize: (dir: String, registry: Hash[String, untyped]) -> void
|
|
285
|
+
def run: (Array[String] arguments, stdout: _Output, stderr: _Output) -> (0 | 1 | 2)
|
|
286
|
+
end
|
|
287
|
+
|
|
178
288
|
class InitCommand
|
|
179
289
|
def self.run: (Array[String] arguments, stdout: _Output, stderr: _Output, dir: String) -> (0 | 1 | 2)
|
|
180
290
|
end
|
|
@@ -194,6 +304,11 @@ module QualityGate
|
|
|
194
304
|
def initialize: (io: _Output) -> void
|
|
195
305
|
def call: (Runner::Result result) -> nil
|
|
196
306
|
end
|
|
307
|
+
|
|
308
|
+
class Doctor
|
|
309
|
+
def initialize: (io: _Output) -> void
|
|
310
|
+
def call: (DoctorReport report, format: String) -> nil
|
|
311
|
+
end
|
|
197
312
|
end
|
|
198
313
|
|
|
199
314
|
type finding_severity = :error | :warning | :info
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: quality_gate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lucian Ghinda
|
|
@@ -202,10 +202,15 @@ files:
|
|
|
202
202
|
- lib/generators/quality_gate/install/templates/agents_section.md.tt
|
|
203
203
|
- lib/generators/quality_gate/install/templates/bullet.rb.tt
|
|
204
204
|
- lib/generators/quality_gate/install/templates/claude_settings.json.tt
|
|
205
|
+
- lib/generators/quality_gate/install/templates/codex_fast.rb.tt
|
|
206
|
+
- lib/generators/quality_gate/install/templates/codex_hooks.json.tt
|
|
207
|
+
- lib/generators/quality_gate/install/templates/codex_verify_stop.rb.tt
|
|
205
208
|
- lib/generators/quality_gate/install/templates/hook_log_filesystem.rb.tt
|
|
206
209
|
- lib/generators/quality_gate/install/templates/quality_gate.yml.tt
|
|
207
210
|
- lib/generators/quality_gate/install/templates/quality_gate_fast.rb.tt
|
|
208
211
|
- lib/generators/quality_gate/install/templates/quality_gate_verify_stop.rb.tt
|
|
212
|
+
- lib/generators/quality_gate/install/templates/quality_gate_workflow.yml.tt
|
|
213
|
+
- lib/generators/quality_gate/install/templates/rails_quality_gate.yml.tt
|
|
209
214
|
- lib/generators/quality_gate/install/templates/rubocop.yml.tt
|
|
210
215
|
- lib/generators/quality_gate/install/templates/ruby_agents_section.md.tt
|
|
211
216
|
- lib/generators/quality_gate/install/templates/ruby_quality_gate.yml.tt
|
|
@@ -217,13 +222,36 @@ files:
|
|
|
217
222
|
- lib/quality_gate/adapter.rb
|
|
218
223
|
- lib/quality_gate/adapters/brakeman.rb
|
|
219
224
|
- lib/quality_gate/adapters/bundler_audit.rb
|
|
225
|
+
- lib/quality_gate/adapters/database_consistency.rb
|
|
226
|
+
- lib/quality_gate/adapters/database_consistency_report.rb
|
|
227
|
+
- lib/quality_gate/adapters/database_consistency_report_item.rb
|
|
228
|
+
- lib/quality_gate/adapters/debride.rb
|
|
229
|
+
- lib/quality_gate/adapters/debride_report.rb
|
|
230
|
+
- lib/quality_gate/adapters/herb.rb
|
|
220
231
|
- lib/quality_gate/adapters/reek.rb
|
|
221
232
|
- lib/quality_gate/adapters/rubocop.rb
|
|
233
|
+
- lib/quality_gate/adapters/rubycritic.rb
|
|
234
|
+
- lib/quality_gate/adapters/rubycritic_report.rb
|
|
222
235
|
- lib/quality_gate/adapters/simplecov.rb
|
|
223
236
|
- lib/quality_gate/adapters/test_suite.rb
|
|
224
237
|
- lib/quality_gate/adapters/undercover.rb
|
|
238
|
+
- lib/quality_gate/baseline.rb
|
|
239
|
+
- lib/quality_gate/baseline_run.rb
|
|
225
240
|
- lib/quality_gate/cli.rb
|
|
241
|
+
- lib/quality_gate/codex_fast_hook.rb
|
|
242
|
+
- lib/quality_gate/codex_patch_files.rb
|
|
243
|
+
- lib/quality_gate/codex_stop_hook.rb
|
|
226
244
|
- lib/quality_gate/config.rb
|
|
245
|
+
- lib/quality_gate/database_consistency_runner.rb
|
|
246
|
+
- lib/quality_gate/doctor.rb
|
|
247
|
+
- lib/quality_gate/doctor_bounded_file.rb
|
|
248
|
+
- lib/quality_gate/doctor_command.rb
|
|
249
|
+
- lib/quality_gate/doctor_coverage.rb
|
|
250
|
+
- lib/quality_gate/doctor_git.rb
|
|
251
|
+
- lib/quality_gate/doctor_hooks.rb
|
|
252
|
+
- lib/quality_gate/doctor_launchers.rb
|
|
253
|
+
- lib/quality_gate/doctor_path_lookup.rb
|
|
254
|
+
- lib/quality_gate/doctor_report.rb
|
|
227
255
|
- lib/quality_gate/exit_code.rb
|
|
228
256
|
- lib/quality_gate/finding.rb
|
|
229
257
|
- lib/quality_gate/hook_log.rb
|
|
@@ -231,6 +259,7 @@ files:
|
|
|
231
259
|
- lib/quality_gate/installation.rb
|
|
232
260
|
- lib/quality_gate/installer.rb
|
|
233
261
|
- lib/quality_gate/railtie.rb
|
|
262
|
+
- lib/quality_gate/reporters/doctor.rb
|
|
234
263
|
- lib/quality_gate/reporters/field_sanitizer.rb
|
|
235
264
|
- lib/quality_gate/reporters/json.rb
|
|
236
265
|
- lib/quality_gate/reporters/markdown.rb
|