From bc55776b1d34a9d1922508f60577b310d4c11049 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Thu, 25 Aug 2022 15:36:53 -0500 Subject: [PATCH 1/3] formatter/formatter_set_spec.rb - remove references to file IO on Windows --- spec/rubocop/formatter/formatter_set_spec.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spec/rubocop/formatter/formatter_set_spec.rb b/spec/rubocop/formatter/formatter_set_spec.rb index eeb86b40fcb..2016b0bb510 100644 --- a/spec/rubocop/formatter/formatter_set_spec.rb +++ b/spec/rubocop/formatter/formatter_set_spec.rb @@ -3,6 +3,11 @@ RSpec.describe RuboCop::Formatter::FormatterSet do subject(:formatter_set) { described_class.new } + win_close = lambda do |fset| + fset.close_output_files + fset.each { |f| f.instance_variable_set :@output, nil } + end + it 'responds to all formatter API methods' do %i[started file_started file_finished finished].each do |method| expect(formatter_set).to respond_to(method) @@ -52,6 +57,7 @@ formatter_set.add_formatter('simple', output_path) expect(formatter_set.first.output.class).to eq(File) expect(formatter_set.first.output.path).to eq(output_path) + win_close.call(formatter_set) if RuboCop::Platform.windows? end context "when parent directories don't exist" do @@ -60,13 +66,11 @@ after { FileUtils.rm_rf(tmpdir) } it 'creates them' do - # FIXME: Skips this spec to prevent `Errno::EACCES` error in mingw CI matrix. - skip if ENV['GITHUB_JOB'] == 'main' && ENV['MSYSTEM'] == 'MINGW64' - output_path = File.join(tmpdir, 'path/does/not/exist') formatter_set.add_formatter('simple', output_path) expect(formatter_set.first.output.class).to eq(File) expect(formatter_set.first.output.path).to eq(output_path) + win_close.call(formatter_set) if RuboCop::Platform.windows? end end end @@ -91,10 +95,12 @@ it 'closes all output files' do formatter_set.close_output_files formatter_set[0..1].each { |formatter| expect(formatter.output.closed?).to be(true) } + win_close.call(formatter_set) if RuboCop::Platform.windows? end it 'does not close non file output' do expect(formatter_set[2].output.closed?).to be(false) + win_close.call(formatter_set) if RuboCop::Platform.windows? end end From fef62123eb502e978bba44ba2428febe0f3bb3db Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Thu, 25 Aug 2022 15:37:31 -0500 Subject: [PATCH 2/3] .gitignore - add vendor/ for local development --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b90a35666a1..f13b2f53b1f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ doc .bundle Gemfile.lock Gemfile.local +vendor/ # rbenv .ruby-version From 5b1bb600fcfe6a842ad73335b098d81d6fa5eec4 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Thu, 25 Aug 2022 16:03:33 -0500 Subject: [PATCH 3/3] Actions - add workflow_dispatch for use in forks --- .github/workflows/linting.yml | 1 + .github/workflows/rubocop.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 3fa1fd44633..8365b5d6c8d 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,6 +1,7 @@ name: Linting on: - pull_request + - workflow_dispatch jobs: yamllint: name: Yamllint diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 5d1efa5ed84..13ca3d425b2 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -7,6 +7,7 @@ on: branches: - master pull_request: + workflow_dispatch: jobs: main: