On Fri, Oct 30, 2020 at 03:07:29PM +0800, Lin Jiaxin wrote:
On Fri, Oct 30, 2020 at 02:56:50PM +0800, Luan Shengde wrote:
[why]: esaier for user to config the default yaml file
[how]: when get request data, parse the data and write the user infos to
- def setup_default_yaml(account)
- default_yaml_dir = File.join('/home', account, '.config/compass-ci/defaults')
- FileUtils.mkdir_p default_yaml_dir
- File.open("#{default_yaml_dir}/#{account}.yaml", 'a') do |file|
file.puts "my_email: #{@data['my_email']}"
file.puts "my_name: #{@data['my_name']}" if @data.key? 'my_name'
file.puts "my_uuid: #{@data['my_uuid']}" if @data.key? 'my_uuid'
file.puts "lab: #{@data['lab']}" if @data.key? 'lab'
file.puts "my_email: #{@data['my_email']}" file.puts "my_name: #{@data['my_name']}" if @data.key? 'my_name' file.puts "my_uuid: #{@data['my_uuid']}" if @data.key? 'my_uuid' file.puts "lab: #{@data['lab']}" if @data.key? 'lab'
if write like this, the rubocop will throw offenses: get_account_info.rb.bk:128:16: C: Layout/SpaceBeforeFirstArg: Put one space between the method name and the first argument. file.puts "lab: #{@data['lab']}" if @data.key? 'lab' ^^^^^^^^^^^
Thanks Luan Shengde
align with if
Thanks, Jiaxin