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: 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 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