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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a6f4bc89fcaa0b13753ab758e0c6f4dd5083c1c6509136c941d07a7f712dd6f
4
- data.tar.gz: 7916aa6ccba90cc9898b5ad06080cf02bb2761b0f48697f5514e5fea18482049
3
+ metadata.gz: 30ae8847a7ab0729d5e877f42348713b93f0354c6ea0961f9e5b8cd44a8c18e6
4
+ data.tar.gz: e8f469de2c467669cc6ebe5cd2c25a8707749b0901f2165049249962bcbb0868
5
5
  SHA512:
6
- metadata.gz: ac49213f58a6378ced0bf2ecfb1a82e91a2e6252083efaefe6936d1bf6db7a9b5bb61a9d5e78f95e4a79247b17d0eee67877497921a3bd10bc45bf601d3af961
7
- data.tar.gz: eb2a4a4ebd927e4a885dc1105adfecf3e383666b238fe531795b59a718176602bdc19ce3c198c44c6e252eb39fa04ed2a256dde3531648ba8f321a546b721f16
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'])
@@ -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\e[0;35m#{level.to_s.upcase}#{' ' * (12 - level.size)}\e[m#{"\t" * indentation}#{message}"
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 => 'master' # the default Git ref used when updating
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}` (#{example.file}:#{changed_line_number})
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
@@ -7,7 +7,7 @@ loader.push_dir(__dir__)
7
7
  loader.setup
8
8
 
9
9
  module Confiner
10
- VERSION = '0.2.0'
10
+ VERSION = '0.2.1'
11
11
 
12
12
  module Plugins; end
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confiner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality