From 8e1715b5f17a1a91d5d93c5f3125c3d83111b3c9 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sun, 1 Sep 2024 19:08:10 +0200 Subject: [PATCH] Switch to default RuboCop LineContinuationLeadingSpace style --- .rubocop.yml | 4 --- Rakefile | 6 ++-- lib/aruba/api/core.rb | 30 +++++++++---------- .../command/be_successfully_executed.rb | 4 +-- .../matchers/command/have_output_size.rb | 4 +-- lib/aruba/processes/debug_process.rb | 8 ++--- lib/aruba/processes/spawn_process.rb | 6 ++-- spec/aruba/matchers/file_spec.rb | 8 ++--- spec/aruba/platforms/unix_platform_spec.rb | 6 ++-- spec/aruba/platforms/windows_platform_spec.rb | 6 ++-- 10 files changed, 39 insertions(+), 43 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index d937921c..1b87e24a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -32,10 +32,6 @@ Gemspec/DevelopmentDependencies: Gemspec/RequireMFA: Enabled: false -# Spaces in strings with line continuations go at the beginning of the line. -Layout/LineContinuationLeadingSpace: - EnforcedStyle: leading - # Assume the programmer knows how bracketed block syntax works Lint/AmbiguousBlockAssociation: Enabled: false diff --git a/Rakefile b/Rakefile index 52320ce3..dd17b0f1 100644 --- a/Rakefile +++ b/Rakefile @@ -15,9 +15,9 @@ Cucumber::Rake::Task.new do |t| t.cucumber_opts = %w[--format progress] end -Cucumber::Rake::Task.new('cucumber:wip', 'Run Cucumber features' \ - ' which are "WORK IN PROGRESS" and' \ - ' are allowed to fail') do |t| +Cucumber::Rake::Task.new('cucumber:wip', 'Run Cucumber features ' \ + 'which are "WORK IN PROGRESS" and ' \ + 'are allowed to fail') do |t| t.cucumber_opts = %w[--tags @wip:3 --wip] end diff --git a/lib/aruba/api/core.rb b/lib/aruba/api/core.rb index 06e785cb..0f148994 100644 --- a/lib/aruba/api/core.rb +++ b/lib/aruba/api/core.rb @@ -145,18 +145,18 @@ def cd(dir, &block) # def expand_path(file_name, dir_string = nil) unless file_name.is_a?(String) && !file_name.empty? - message = "Filename #{file_name} needs to be a string." \ - ' It cannot be nil or empty either.' \ - " Please use `expand_path('.')` if you want" \ - ' the current directory to be expanded.' + message = "Filename #{file_name} needs to be a string. " \ + 'It cannot be nil or empty either. ' \ + "Please use `expand_path('.')` if you want " \ + 'the current directory to be expanded.' raise ArgumentError, message end unless Aruba.platform.directory? File.join(aruba.config.root_directory, aruba.config.working_directory) - raise "Aruba's working directory does not exist." \ - ' Maybe you forgot to run `setup_aruba` before using its API.' + raise "Aruba's working directory does not exist. " \ + 'Maybe you forgot to run `setup_aruba` before using its API.' end prefix = file_name[0] @@ -169,10 +169,10 @@ def expand_path(file_name, dir_string = nil) .map { |p| format('"%s"', p) }.join(', ') raise ArgumentError, - "Fixture \"#{rest}\" does not exist" \ - " in fixtures directory \"#{aruba.fixtures_directory}\"." \ - ' This was the one we found first on your system from all possible' \ - " candidates: #{aruba_fixture_candidates}." + "Fixture \"#{rest}\" does not exist " \ + "in fixtures directory \"#{aruba.fixtures_directory}\". " \ + 'This was the one we found first on your system from all possible ' \ + "candidates: #{aruba_fixture_candidates}." end path @@ -194,11 +194,11 @@ def expand_path(file_name, dir_string = nil) caller_location = caller_locations(1, 1).first caller_file_line = "#{caller_location.path}:#{caller_location.lineno}" message = - "Aruba's `expand_path` method was called with an absolute path" \ - " at #{caller_file_line}, which is not recommended." \ - " The path passed was '#{file_name}'." \ - ' Change the call to pass a relative path or set' \ - ' `config.allow_absolute_paths = true` to silence this warning' + "Aruba's `expand_path` method was called with an absolute path " \ + "at #{caller_file_line}, which is not recommended. " \ + "The path passed was '#{file_name}'. " \ + 'Change the call to pass a relative path or set ' \ + '`config.allow_absolute_paths = true` to silence this warning' raise UserError, message end file_name diff --git a/lib/aruba/matchers/command/be_successfully_executed.rb b/lib/aruba/matchers/command/be_successfully_executed.rb index d794ce22..7f2d272e 100644 --- a/lib/aruba/matchers/command/be_successfully_executed.rb +++ b/lib/aruba/matchers/command/be_successfully_executed.rb @@ -29,8 +29,8 @@ end failure_message do |_actual| - "Expected `#{@actual}` to succeed" \ - ' but got non-zero exit status and the following output:' \ + "Expected `#{@actual}` to succeed " \ + 'but got non-zero exit status and the following output:' \ "\n\n#{@old_actual.output}\n" end end diff --git a/lib/aruba/matchers/command/have_output_size.rb b/lib/aruba/matchers/command/have_output_size.rb index e2b6ca03..2138e952 100644 --- a/lib/aruba/matchers/command/have_output_size.rb +++ b/lib/aruba/matchers/command/have_output_size.rb @@ -28,8 +28,8 @@ match do |actual| if actual.respond_to? :size Aruba.platform.deprecated \ - 'Application of the have_output_size matcher to a string is deprecated.' \ - ' Apply the matcher directly to the process object instead' + 'Application of the have_output_size matcher to a string is deprecated. ' \ + 'Apply the matcher directly to the process object instead' actual_size = actual.size elsif actual.respond_to? :output actual_size = actual.output.size diff --git a/lib/aruba/processes/debug_process.rb b/lib/aruba/processes/debug_process.rb index 18115759..4efa6a39 100644 --- a/lib/aruba/processes/debug_process.rb +++ b/lib/aruba/processes/debug_process.rb @@ -43,8 +43,8 @@ def stdin(*); end # @return [String] # A predefined string to make users aware they are using the DebugProcess def stdout(*) - 'This is the debug launcher on STDOUT.' \ - ' If this output is unexpected, please check your setup.' + 'This is the debug launcher on STDOUT. ' \ + 'If this output is unexpected, please check your setup.' end # Return stderr @@ -52,8 +52,8 @@ def stdout(*) # @return [String] # A predefined string to make users aware they are using the DebugProcess def stderr(*) - 'This is the debug launcher on STDERR.' \ - ' If this output is unexpected, please check your setup.' + 'This is the debug launcher on STDERR. ' \ + 'If this output is unexpected, please check your setup.' end # Write to nothing diff --git a/lib/aruba/processes/spawn_process.rb b/lib/aruba/processes/spawn_process.rb index 0bdc73a6..01240166 100644 --- a/lib/aruba/processes/spawn_process.rb +++ b/lib/aruba/processes/spawn_process.rb @@ -146,9 +146,9 @@ def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, # rubocop: def start if started? error_message = - "Command \"#{commandline}\" has already been started." \ - ' Please `#stop` the command first and `#start` it again.' \ - ' Alternatively use `#restart`.' + "Command \"#{commandline}\" has already been started. " \ + 'Please `#stop` the command first and `#start` it again. ' \ + 'Alternatively use `#restart`.' raise CommandAlreadyStartedError, error_message end diff --git a/spec/aruba/matchers/file_spec.rb b/spec/aruba/matchers/file_spec.rb index 154a15ed..b35a454b 100644 --- a/spec/aruba/matchers/file_spec.rb +++ b/spec/aruba/matchers/file_spec.rb @@ -315,8 +315,8 @@ def fail_with(message) it 'provides the correct path value in the message' do expect { expect(file).to be_a_command_found_in_path } .to raise_error RSpec::Expectations::ExpectationNotMetError, - "expected that command \"#{file}\" can be found" \ - " in PATH \"#{expand_path('.')}\"." + "expected that command \"#{file}\" can be found " \ + "in PATH \"#{expand_path('.')}\"." end end @@ -332,8 +332,8 @@ def fail_with(message) it 'provides the correct path value in the message' do expect { expect(file).not_to be_a_command_found_in_path } .to raise_error RSpec::Expectations::ExpectationNotMetError, - "expected that command \"#{file}\" cannot be found" \ - " in PATH \"#{expand_path('.')}\"." + "expected that command \"#{file}\" cannot be found " \ + "in PATH \"#{expand_path('.')}\"." end end end diff --git a/spec/aruba/platforms/unix_platform_spec.rb b/spec/aruba/platforms/unix_platform_spec.rb index 42bfe9bd..4dc7058e 100644 --- a/spec/aruba/platforms/unix_platform_spec.rb +++ b/spec/aruba/platforms/unix_platform_spec.rb @@ -10,9 +10,9 @@ it 'works even when ruby is launched with --disable-gems and --disable-rubyopt' do aruba_lib = File.expand_path('../../../lib', __dir__) run_command_and_stop( - "ruby --disable-rubyopt --disable-gems -I#{aruba_lib}" \ - " -e 'require \"aruba/platforms/unix_platform\";" \ - " Aruba::Platforms::UnixPlatform.match?;'" + "ruby --disable-rubyopt --disable-gems -I#{aruba_lib} " \ + "-e 'require \"aruba/platforms/unix_platform\"; " \ + "Aruba::Platforms::UnixPlatform.match?;'" ) expect(last_command_started).to be_successfully_executed end diff --git a/spec/aruba/platforms/windows_platform_spec.rb b/spec/aruba/platforms/windows_platform_spec.rb index d4a801ee..c3a6d113 100644 --- a/spec/aruba/platforms/windows_platform_spec.rb +++ b/spec/aruba/platforms/windows_platform_spec.rb @@ -10,9 +10,9 @@ it 'works even when ruby is launched with --disable-gems and --disable-rubyopt' do aruba_lib = File.expand_path('../../../lib', __dir__) run_command_and_stop( - "ruby --disable-rubyopt --disable-gems -I#{aruba_lib}" \ - " -e 'require \"aruba/platforms/windows_platform\";" \ - " Aruba::Platforms::WindowsPlatform.match?;'" + "ruby --disable-rubyopt --disable-gems -I#{aruba_lib} " \ + "-e 'require \"aruba/platforms/windows_platform\"; " \ + "Aruba::Platforms::WindowsPlatform.match?;'" ) expect(last_command_started).to be_successfully_executed end