[PATCH compass-ci] container/defconfig.rb: fix rubocop warning

W: Lint/UselessAssignment: Useless assignment to variable - kb. Use _ or _kb as a variable name to indicate that it won't be used. File.readlines('/proc/meminfo').map { |s| k, v, kb = s.split; { k.chomp(':') => v } } ^^ C: Style/Semicolon: Do not use semicolons to terminate expressions. File.readlines('/proc/meminfo').map { |s| k, v, kb = s.split; { k.chomp(':') => v } } ^ Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- container/defconfig.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/container/defconfig.rb b/container/defconfig.rb index 482dbc8..d1e2af0 100755 --- a/container/defconfig.rb +++ b/container/defconfig.rb @@ -35,11 +35,11 @@ def docker_rm(container) end def meminfo_hash - File.readlines('/proc/meminfo').map { |s| k, v, kb = s.split; { k.chomp(':') => v } } + YAML.load_file('/proc/meminfo') end def get_available_memory - memtotal = meminfo_hash[0]['MemTotal'].to_f / 1048576 + memtotal = meminfo_hash['MemTotal'].to_f / 1048576 # set container available memory size, minimum size is 1024m, maximum size is 30720m, # take the middle value according to the system memory size. -- 2.23.0
participants (1)
-
Liu Yinsi