[PATCH lkp-tests] stats/sysbench-mariadb: fix rubocop offenses

[errors] Inspecting 1 file C offenses: sysbench-mariadb:4:1: C: Layout/IndentationWidth: Use 2 (not 4) spaces for indentation. case line.chomp! ^^^^ 1 file inspected, 1 offense detected Signed-off-by: Zhang Yale <ylzhangah@qq.com> --- stats/sysbench-mariadb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stats/sysbench-mariadb b/stats/sysbench-mariadb index 0c7ba1d9..0bed3bc0 100755 --- a/stats/sysbench-mariadb +++ b/stats/sysbench-mariadb @@ -1,10 +1,10 @@ #!/usr/bin/env ruby while (line = STDIN.gets) - case line.chomp! - when /transactions:\s+(\d+)/ - puts "transactions: #{$1}" - when /95th percentile:\s+(\S+)/ - puts "95th percentile: #{$1}" - end + case line.chomp! + when /transactions:\s+(\d+)/ + puts "transactions: #{$1}" + when /95th percentile:\s+(\S+)/ + puts "95th percentile: #{$1}" + end end -- 2.23.0

#!/usr/bin/env ruby
while (line = STDIN.gets) - case line.chomp! - when /transactions:\s+(\d+)/ - puts "transactions: #{$1}" - when /95th percentile:\s+(\S+)/ - puts "95th percentile: #{$1}" - end + case line.chomp! + when /transactions:\s+(\d+)/
no need to add chomp! for the lineif not match /xxx$/ Thanks, Luan Shengde
+ puts "transactions: #{$1}" + when /95th percentile:\s+(\S+)/ + puts "95th percentile: #{$1}" + end end -- 2.23.0

On Wed, Nov 18, 2020 at 06:33:55PM +0800, Luan Shengde wrote:
#!/usr/bin/env ruby
while (line = STDIN.gets) - case line.chomp! - when /transactions:\s+(\d+)/ - puts "transactions: #{$1}" - when /95th percentile:\s+(\S+)/ - puts "95th percentile: #{$1}" - end + case line.chomp! + when /transactions:\s+(\d+)/
no need to add chomp! for the lineif not match /xxx$/
It is need the "chomp!", there is no "\s*" in the RegEx. Thanks, Xueliang
Thanks, Luan Shengde
+ puts "transactions: #{$1}" + when /95th percentile:\s+(\S+)/ + puts "95th percentile: #{$1}" + end end -- 2.23.0

On Thu, Nov 19, 2020 at 09:01:29AM +0800, Cao Xueliang wrote:
On Wed, Nov 18, 2020 at 06:33:55PM +0800, Luan Shengde wrote:
#!/usr/bin/env ruby
while (line = STDIN.gets) - case line.chomp! - when /transactions:\s+(\d+)/ - puts "transactions: #{$1}" - when /95th percentile:\s+(\S+)/ - puts "95th percentile: #{$1}" - end + case line.chomp! + when /transactions:\s+(\d+)/
no need to add chomp! for the lineif not match /xxx$/
It is need the "chomp!", there is no "\s*" in the RegEx.
the chomp will not delete the \s*$, unless you use rstrip. Thanks, Yale
Thanks, Xueliang
Thanks, Luan Shengde
+ puts "transactions: #{$1}" + when /95th percentile:\s+(\S+)/ + puts "95th percentile: #{$1}" + end end -- 2.23.0

On Thu, Nov 19, 2020 at 09:13:02AM +0800, Zhang Yale wrote:
On Thu, Nov 19, 2020 at 09:01:29AM +0800, Cao Xueliang wrote:
On Wed, Nov 18, 2020 at 06:33:55PM +0800, Luan Shengde wrote:
#!/usr/bin/env ruby
while (line = STDIN.gets) - case line.chomp! - when /transactions:\s+(\d+)/ - puts "transactions: #{$1}" - when /95th percentile:\s+(\S+)/ - puts "95th percentile: #{$1}" - end + case line.chomp! + when /transactions:\s+(\d+)/
no need to add chomp! for the lineif not match /xxx$/
It is need the "chomp!", there is no "\s*" in the RegEx.
the chomp will not delete the \s*$, unless you use rstrip.
Oh, I got it~ Thanks, Xueliang
Thanks, Yale
Thanks, Xueliang
Thanks, Luan Shengde
+ puts "transactions: #{$1}" + when /95th percentile:\s+(\S+)/ + puts "95th percentile: #{$1}" + end end -- 2.23.0

On Wed, Nov 18, 2020 at 06:33:55PM +0800, Luan Shengde wrote:
#!/usr/bin/env ruby
while (line = STDIN.gets) - case line.chomp! - when /transactions:\s+(\d+)/ - puts "transactions: #{$1}" - when /95th percentile:\s+(\S+)/ - puts "95th percentile: #{$1}" - end + case line.chomp! + when /transactions:\s+(\d+)/
no need to add chomp! for the lineif not match /xxx$/
Thanks, Luan Shengde
Good! Thanks, Yale
+ puts "transactions: #{$1}" + when /95th percentile:\s+(\S+)/ + puts "95th percentile: #{$1}" + end end -- 2.23.0
participants (3)
-
Cao Xueliang
-
Luan Shengde
-
Zhang Yale