From ca275f7b162ac0ed816c2076dad4473e1a67a2fd Mon Sep 17 00:00:00 2001 From: Philip Li Date: Sun, 14 Jan 2024 22:42:47 +0800 Subject: [PATCH] lib: resolve rubocop issues with rubocop 0.50.0 Signed-off-by: Philip Li --- lib/dmesg.rb | 2 +- lib/hash.rb | 7 ++++--- lib/matrix.rb | 10 +++++----- programs/kernel-selftests/parse | 2 +- spec/local_run_spec.rb | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/dmesg.rb b/lib/dmesg.rb index b09a6309b..adc8280f2 100755 --- a/lib/dmesg.rb +++ b/lib/dmesg.rb @@ -30,7 +30,7 @@ def fixup_dmesg(line) # break up mixed messages case line - when /^<[0-9]>|^(kern |user |daemon):......: / + when /^<[0-9]>|^(kern |user |daemon):......: / # rubocop:disable Lint/EmptyWhen # line keeps no change when /(.+)(\[ *[0-9]{1,6}\.[0-9]{6}\] .*)/ line = "#{$1}\n#{$2}" diff --git a/lib/hash.rb b/lib/hash.rb index 12a5434a0..5c8814bfa 100755 --- a/lib/hash.rb +++ b/lib/hash.rb @@ -22,10 +22,11 @@ def lookup_hash(hash, path, create_missing: false) end ACCUMULATIVE_KEYS = %w( - mail_to - mail_cc - constraints + mail_to + mail_cc + constraints ).freeze + def accumulative_key?(k) return true if ACCUMULATIVE_KEYS.include? k return true if k =~ /^need_/ && k !~ /^need_(memory|cpu|modules)$/ diff --git a/lib/matrix.rb b/lib/matrix.rb index 5fc840e8c..acaec6a2f 100755 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -309,11 +309,11 @@ def merge_matrixes(matrixes) def check_warn_test_error(matrix, _result_root) ids = %w( - last_state.is_incomplete_run - last_state.exit_fail - stderr.has_stderr - phoronix-test-suite.has_failure - ) + last_state.is_incomplete_run + last_state.exit_fail + stderr.has_stderr + phoronix-test-suite.has_failure + ) ids.each do |errid| samples = matrix[errid] diff --git a/programs/kernel-selftests/parse b/programs/kernel-selftests/parse index 3d0976ddf..65c19ff5d 100755 --- a/programs/kernel-selftests/parse +++ b/programs/kernel-selftests/parse @@ -885,7 +885,7 @@ end class TimensStater < Stater def stat(line, stats) case line - when /# SKIP CLOCK_BOOTTIME_ALARM isn't supported/ + when /# SKIP CLOCK_BOOTTIME_ALARM isn't supported/ # rubocop:disable Lint/EmptyWhen # ignore below skip, cause there's no test name when it skipped, # thus it's meaningless for auto-bisect # selftests: timens: timens diff --git a/spec/local_run_spec.rb b/spec/local_run_spec.rb index 05a238fe9..f4853a7ee 100755 --- a/spec/local_run_spec.rb +++ b/spec/local_run_spec.rb @@ -11,7 +11,7 @@ FileUtils.cp "#{LKP_SRC}/lib/run_env.rb", @tmp_file s = '' File.open(@tmp_file, 'r') do |f| - f.each_line { |l| s += l.gsub(/\#{LKP_SRC}\/hosts\//, "#{@tmp_dir}/") } + f.each_line { |l| s += l.gsub(/\#{LKP_SRC}\/hosts\//, "#{@tmp_dir}/") } # rubocop:disable Lint/InterpolationCheck f.rewind end File.open(@tmp_file, 'w') { |f| f.write s }