confiner 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/confiner/cli.rb +1 -0
- data/lib/confiner/logger.rb +5 -1
- data/lib/confiner/plugins/debug.rb +14 -0
- data/lib/confiner/plugins/gitlab.rb +2 -2
- data/lib/confiner.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30ae8847a7ab0729d5e877f42348713b93f0354c6ea0961f9e5b8cd44a8c18e6
|
4
|
+
data.tar.gz: e8f469de2c467669cc6ebe5cd2c25a8707749b0901f2165049249962bcbb0868
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f430addea12b346909efd5568a85d9232fd6f4969258d0aaa5cb9e8344fab58791378734e2c89d58069044739218bd45155ef293487b9a93b95ae5185ed55c7
|
7
|
+
data.tar.gz: 190392762988fa1273a0e32aa6f74aa9f467879a93729e7a139204e09fb5206cab90e3fecca13a51734bd8917bb2b153e907fc869a3274534f79f163c1dd8d7b
|
data/lib/confiner/cli.rb
CHANGED
@@ -110,6 +110,7 @@ module Confiner
|
|
110
110
|
def process_rule(rule)
|
111
111
|
log :rule, rule.keys.map { |k| "\t#{k}=#{rule[k]}" }.join(',')
|
112
112
|
|
113
|
+
rule['plugin']['args'] ||= {}
|
113
114
|
rule['plugin']['args'].transform_keys!(&:to_sym) # 2.5 compatability
|
114
115
|
|
115
116
|
plugin = Plugins.const_get(translate_plugin_name(rule['plugin']['name'])).new(**rule['plugin']['args'])
|
data/lib/confiner/logger.rb
CHANGED
@@ -4,9 +4,13 @@ module Confiner
|
|
4
4
|
module Logger
|
5
5
|
# Log something with a specific level
|
6
6
|
def log(level, message, indentation = 1)
|
7
|
+
color = "\e[0;35m" # default purple
|
8
|
+
color = "\e[0;33m" if %i[warn warning].include?(level) # yellow
|
9
|
+
color = "\e[0;31m" if %i[err error fatal].include?(level) # red
|
10
|
+
|
7
11
|
raise ArgumentError, 'Level must be less than 12 characters' if level.size > 12
|
8
12
|
|
9
|
-
output = "(#{Time.now.strftime('%F %H:%M:%S')})\t
|
13
|
+
output = "(#{Time.now.strftime('%F %H:%M:%S')})\t#{color}#{level.to_s.upcase}#{' ' * (12 - level.size)}\e[m#{"\t" * indentation}#{message}"
|
10
14
|
|
11
15
|
Logger.log_to.puts(output)
|
12
16
|
end
|
@@ -12,6 +12,20 @@ module Confiner
|
|
12
12
|
def action2
|
13
13
|
log :debug, arg2
|
14
14
|
end
|
15
|
+
|
16
|
+
def warn
|
17
|
+
log :warn, 'Warn'
|
18
|
+
log :warning, 'Warning'
|
19
|
+
end
|
20
|
+
|
21
|
+
def fatal
|
22
|
+
log :fatal, 'Fatal'
|
23
|
+
end
|
24
|
+
|
25
|
+
def error
|
26
|
+
log :err, 'Err'
|
27
|
+
log :error, 'Error'
|
28
|
+
end
|
15
29
|
end
|
16
30
|
end
|
17
31
|
end
|
@@ -14,7 +14,7 @@ module Confiner
|
|
14
14
|
:threshold => 3, # the failure / pass threshold
|
15
15
|
:endpoint => 'https://gitlab.com/api/v4', # the GitLab API Endpoint (e.g. https://gitlab.com/api/v4)
|
16
16
|
:pwd => '.', # the path of the working directory for the examples
|
17
|
-
:ref => '
|
17
|
+
:ref => 'main' # the default Git ref used when updating
|
18
18
|
|
19
19
|
MERGE_REQUEST_TITLE = '[QUARANTINE] %s'
|
20
20
|
QUARANTINE_METADATA = %(, quarantine: { issue: '%s', type: :investigating })
|
@@ -231,7 +231,7 @@ module Confiner
|
|
231
231
|
description = <<~MARKDOWN
|
232
232
|
## What does this MR do?
|
233
233
|
|
234
|
-
Quarantines the test `#{example.name}` (
|
234
|
+
Quarantines the test `#{example.name}` (https://gitlab.com/#{target_project}/-/blob/#{ref}/#{example.file}#L#{changed_line_number})
|
235
235
|
|
236
236
|
This test has been found by [Confiner](https://gitlab.com/gitlab-org/quality/confiner) to have been failing for
|
237
237
|
more than (or equal to) #{threshold} times. This test has failed #{occurrences.size} times.
|
data/lib/confiner.rb
CHANGED