Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rubocop corrections #41

Merged
merged 3 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion spec/classes/inet_filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
end

context 'custom log prefix with variable substitution' do
let(:pre_condition) { 'class{\'nftables\': log_prefix => " bar [%<chain>s] "}' } # rubocop:disable Style/FormatStringToken
let(:pre_condition) { 'class{\'nftables\': log_prefix => " bar [%<chain>s] "}' }

it {
is_expected.to contain_concat__fragment('nftables-inet-filter-chain-INPUT-rule-log_discarded').with(
Expand Down
20 changes: 10 additions & 10 deletions spec/classes/nftables_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/facter/nftables_spec.rb
Original file line number Diff line number Diff line change
@@ -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')
Expand Down