From 731bc2e0855de04ec7f57d63e09105fa7f619a45 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 11 Feb 2026 22:15:43 +0100 Subject: bin: improve the style and add more documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And also run rubocop on the CI for good measure. Signed-off-by: Miquel Sabaté Solà --- bin/values.rb | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) mode change 100644 => 100755 bin/values.rb (limited to 'bin/values.rb') diff --git a/bin/values.rb b/bin/values.rb old mode 100644 new mode 100755 index 3ff1578..e5128aa --- a/bin/values.rb +++ b/bin/values.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true ## # Generate the different values on `config/values/*.s` by parsing the values on @@ -19,7 +20,8 @@ config = YAML.safe_load_file(File.join(config_path, 'values.yml')) # 4.4 format. def to_signed_fixed_point(value) integer = value.to_i - raise "bad signed fixed point value" if integer > 7 || integer < -7 + raise 'bad signed fixed point value' if integer > 7 || integer < -7 + integer &= 0b00001111 decimal = (value % 1) * 100 @@ -58,23 +60,21 @@ def to_hex(value) end def values_to_asm(values) - contents = "" - values.each { |k, v| contents << " #{k} = #{to_hex(v)}\n" } - contents.rstrip + values.map { |k, v| " #{k} = #{to_hex(v)}" }.join("\n") end res.each do |model, formats| path = File.join(config_path, "values/#{model}.s") - contents = <