Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
jiikko committed Jan 21, 2024
1 parent 702bf18 commit d494ba5
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ Lint/AmbiguousBlockAssociation:
Enabled: false
Security/Eval:
Enabled: false
Lint/MissingSuper:
Enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def open_macro(name, steps: [], if_pressed: nil, if_tilted_left_stick: nil, forc
return
end

macro_name = name || "OpenMacro-#{steps.join}".to_sym
macro_name = name || :"OpenMacro-#{steps.join}"
@context.macro_registry.install_plugin(macro_name, steps: steps)
self.macros[macro_name] = { if_pressed: if_pressed, if_tilted_left_stick: if_tilted_left_stick, force_neutral: force_neutral }.compact
end
Expand Down
2 changes: 1 addition & 1 deletion lib/procon_bypass_man/bypass/bypass_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def execute
# TODO: 本当はいらないんだけど、なぜか反映されないのでここでも設定する
BlueGreenProcess.config.logger = ProconBypassMan.logger

while(readable_io = IO.select([self_read]))
while(readable_io = self_read.wait_readable)
signal = readable_io.first[0].gets.strip
case signal
when 'USR2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ def self.execute
message = BootMessage.new
ProconBypassMan::ReportBootJob.perform_async(message.to_hash)
ProconBypassMan.logger.info message.to_s
puts message.to_s
puts message
end
end
3 changes: 2 additions & 1 deletion lib/procon_bypass_man/device_connection/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def self.execute!(retry_count: 0)

retry_count = retry_count + 1
retry
rescue ProconBypassMan::DeviceConnection::NotFoundProconError, ProconBypassMan::DeviceConnection::SetupIncompleteError => e
rescue ProconBypassMan::DeviceConnection::NotFoundProconError, ProconBypassMan::DeviceConnection::SetupIncompleteError => e # rubocop:disable Lint/UselessRescue
# TODO: エラークラスを作ってなげる
raise
end

Expand Down
2 changes: 1 addition & 1 deletion lib/procon_bypass_man/external_input/external_data.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module ProconBypassMan
module ExternalInput
class ExternalData
UNPRESS_BUTTONS = Set.new(ProconBypassMan::Procon::ButtonCollection.available.map { |x| "un#{x}".to_sym })
UNPRESS_BUTTONS = Set.new(ProconBypassMan::Procon::ButtonCollection.available.map { |x| :"un#{x}" })

# @return [String, NilClass] 16進数表現のデータ
attr_reader :hex
Expand Down
2 changes: 1 addition & 1 deletion lib/procon_bypass_man/procon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def apply!
no_op_step = :wait_for_0_3 # マクロの最後に固まって最後の入力をし続けるので、無の状態を最後に注入する
BlueGreenProcess::SharedVariable.extend_run_on_this_process = true
ProconBypassMan.buttons_setting_configuration.macro_registry.cleanup_remote_macros!
macro_name = task.name || "RemoteMacro-#{task.steps.join}".to_sym
macro_name = task.name || :"RemoteMacro-#{task.steps.join}"
task.steps << no_op_step
ProconBypassMan.buttons_setting_configuration.macro_registry.install_plugin(macro_name, steps: task.steps, macro_type: :remote)
@@status[:ongoing_macro] = ProconBypassMan.buttons_setting_configuration.macro_registry.load(macro_name, macro_type: :remote) do
Expand Down
4 changes: 2 additions & 2 deletions lib/procon_bypass_man/procon/macro_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def self.merge(subjects)

class Subject
def initialize(value)
if not /^shake_/ =~ value
if not (/^shake_/ =~ value)
@button =
if match = value.match(/_(\w+)\z/)
match[1]
Expand Down Expand Up @@ -106,7 +106,7 @@ def build_if_v2_format?(step: )
end

if /^rotation_left_stick/ =~ step
roll_left_stick_steps = 0.step(359, 17).map { |x| ["tilt_left_stick_completely_to_#{x}deg".to_sym] }
roll_left_stick_steps = 0.step(359, 17).map { |x| [:"tilt_left_stick_completely_to_#{x}deg"] }
return { steps: roll_left_stick_steps }
end

Expand Down
2 changes: 1 addition & 1 deletion lib/procon_bypass_man/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run

begin
# TODO 子プロセスが消滅した時に、メインプロセスは生き続けてしまい、何もできなくなる問題がある
while(readable_io = IO.select([self_read]))
while(readable_io = self_read.wait_readable)
signal = readable_io.first[0].gets.strip
ProconBypassMan.logger.debug "[BYPASS] MASTERプロセスで#{signal}シグナルを受け取りました"
case signal
Expand Down
2 changes: 1 addition & 1 deletion lib/procon_bypass_man/support/can_over_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.extended(mod)
def start_distributed_object!
return unless enable?

FileUtils.rm_rf(socket_file_path) if File.exist?(socket_file_path)
FileUtils.rm_rf(socket_file_path)
begin
self.drb_server = DRb.start_service(socket_path, distributed_class.new, safe_level: 1)
rescue Errno::EADDRINUSE => e
Expand Down

0 comments on commit d494ba5

Please sign in to comment.