From 492ca838394c27d7946304259137ea13b8c4fc65 Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Tue, 8 Dec 2020 15:23:23 +0100 Subject: [PATCH 1/3] Disable Disable TrailingCommaInArguments early Can be reverted once https://github.com/voxpupuli/voxpupuli-test/pull/36 is released --- .rubocop.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 198a3599..e91d6f98 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,8 @@ --- inherit_gem: voxpupuli-test: rubocop.yml + +# Remove once released +# https://github.com/voxpupuli/voxpupuli-test/pull/36 +Style/TrailingCommaInArguments: + Enabled: False From da8956d39ca48f34ab21c99e2ee2e9623d81868e Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Tue, 8 Dec 2020 15:28:04 +0100 Subject: [PATCH 2/3] Enable rubocop check Will submit centrally if all well. --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4f47e87..3ebf75f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }} puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} env: - BUNDLE_WITHOUT: development:test:release + BUNDLE_WITHOUT: development:release steps: - uses: actions/checkout@v2 - name: Setup ruby @@ -21,6 +21,8 @@ jobs: bundler-cache: true - name: Run rake validate run: bundle exec rake validate + - name: Run rake rubocop https://github.com/voxpupuli/modulesync_config/pull/690 + run: bundle exec rake rubocop - name: Setup Test Matrix id: get-outputs run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false From 7e5b657a58fc94f81a6cc21a54d21023cee3bebb Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Tue, 8 Dec 2020 15:30:22 +0100 Subject: [PATCH 3/3] rubocop:auto_correct fixes --- spec/classes/inet_filter_spec.rb | 2 +- spec/classes/nftables_spec.rb | 20 ++++++++++---------- spec/defines/set_spec.rb | 2 +- spec/unit/facter/nftables_spec.rb | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/classes/inet_filter_spec.rb b/spec/classes/inet_filter_spec.rb index 3a1dad49..b3dc794d 100644 --- a/spec/classes/inet_filter_spec.rb +++ b/spec/classes/inet_filter_spec.rb @@ -441,7 +441,7 @@ end context 'custom log prefix with variable substitution' do - let(:pre_condition) { 'class{\'nftables\': log_prefix => " bar [%s] "}' } # rubocop:disable Style/FormatStringToken + let(:pre_condition) { 'class{\'nftables\': log_prefix => " bar [%s] "}' } it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-INPUT-rule-log_discarded').with( diff --git a/spec/classes/nftables_spec.rb b/spec/classes/nftables_spec.rb index fe7ab8aa..4974bc94 100644 --- a/spec/classes/nftables_spec.rb +++ b/spec/classes/nftables_spec.rb @@ -177,8 +177,8 @@ context 'with no nftables fact' do it { - is_expected.to contain_systemd__dropin_file('puppet_nft.conf') - .with_content(%r{^ExecReload.*flush ruleset; include.*$}) + is_expected.to contain_systemd__dropin_file('puppet_nft.conf'). + with_content(%r{^ExecReload.*flush ruleset; include.*$}) } it { is_expected.to contain_file('/etc/nftables/puppet-preflight.nft').with_content(%r{^flush ruleset$}) } end @@ -189,12 +189,12 @@ end it { - is_expected.to contain_systemd__dropin_file('puppet_nft.conf') - .with_content(%r{^ExecReload.*flush table inet abc; include.*$}) + is_expected.to contain_systemd__dropin_file('puppet_nft.conf'). + with_content(%r{^ExecReload.*flush table inet abc; include.*$}) } it { - is_expected.to contain_file('/etc/nftables/puppet-preflight.nft') - .with_content(%r{^flush table inet abc$}) + is_expected.to contain_file('/etc/nftables/puppet-preflight.nft'). + with_content(%r{^flush table inet abc$}) } end context 'with nftables fact not matching' do @@ -203,12 +203,12 @@ end it { - is_expected.to contain_systemd__dropin_file('puppet_nft.conf') - .with_content(%r{^ExecReload.*flush table inet abc; flush table inet ijk; include.*$}) + is_expected.to contain_systemd__dropin_file('puppet_nft.conf'). + with_content(%r{^ExecReload.*flush table inet abc; flush table inet ijk; include.*$}) } it { - is_expected.to contain_file('/etc/nftables/puppet-preflight.nft') - .with_content(%r{^flush table inet abc; flush table inet ijk$}) + is_expected.to contain_file('/etc/nftables/puppet-preflight.nft'). + with_content(%r{^flush table inet abc; flush table inet ijk$}) } end end diff --git a/spec/defines/set_spec.rb b/spec/defines/set_spec.rb index 47e9d02e..0a5ce4c9 100644 --- a/spec/defines/set_spec.rb +++ b/spec/defines/set_spec.rb @@ -81,7 +81,7 @@ let(:params) do { type: 'ipv4_addr', - flags: ['interval', 'timeout'], + flags: %w[interval timeout], elements: ['192.168.0.1/24'], auto_merge: true, } diff --git a/spec/unit/facter/nftables_spec.rb b/spec/unit/facter/nftables_spec.rb index fcab4000..72f6cc64 100644 --- a/spec/unit/facter/nftables_spec.rb +++ b/spec/unit/facter/nftables_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'nftables' do - before(:each) do + before do Facter.clear Process.stubs(:uid).returns(0) Facter::Util::Resolution.stubs(:which).with('nft').returns('/usr/sbin/nft')