Skip to content

Commit 1a4d208

Browse files
committed
test: fix rubocop violations
Use method: 1. `rubocop -a --safe` 2. `rubocop -A --safe` 3. Use `rubocop:disable` ``` Offenses: test/integration/default/controls/config_spec.rb:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment. control 'Php configuration' do ^ test/integration/default/controls/config_spec.rb:4:3: C: Metrics/AbcSize: Assignment Branch Condition size for test_debian is too high. [<0, 26, 0> 26/17] (http://c2.com/cgi/wiki?AbcMetric, https://en.wikipedia.org/wiki/ABC_Software_Metric) def test_debian ... ^^^^^^^^^^^^^^^ test/integration/default/controls/config_spec.rb:4:3: C: Metrics/MethodLength: Method has too many lines. [14/10] (https://rubystyle.guide#short-methods) def test_debian ... ^^^^^^^^^^^^^^^ test/integration/default/controls/config_spec.rb:24:3: C: Style/EmptyMethod: Put empty method definitions on a single line. (https://rubystyle.guide#no-single-line-methods) def test_redhat ... ^^^^^^^^^^^^^^^ test/integration/default/controls/config_spec.rb:27:3: C: Style/EmptyMethod: Put empty method definitions on a single line. (https://rubystyle.guide#no-single-line-methods) def test_suse ... ^^^^^^^^^^^^^ test/integration/default/controls/package_spec.rb:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment. control 'Php package' do ^ test/integration/default/controls/package_spec.rb:4:3: C: Metrics/AbcSize: Assignment Branch Condition size for test_debian is too high. [<1, 26, 1> 26.04/17] (http://c2.com/cgi/wiki?AbcMetric, https://en.wikipedia.org/wiki/ABC_Software_Metric) def test_debian ... ^^^^^^^^^^^^^^^ test/integration/default/controls/package_spec.rb:4:3: C: Metrics/MethodLength: Method has too many lines. [20/10] (https://rubystyle.guide#short-methods) def test_debian ... ^^^^^^^^^^^^^^^ test/integration/default/controls/package_spec.rb:21:1: C: Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning. (https://rubystyle.guide#empty-lines-around-bodies) test/integration/default/controls/service_spec.rb:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment. control 'Php service' do ^ test/integration/default/controls/service_spec.rb:16:3: C: Style/EmptyMethod: Put empty method definitions on a single line. (https://rubystyle.guide#no-single-line-methods) def test_redhat ... ^^^^^^^^^^^^^^^ test/integration/default/controls/service_spec.rb:19:3: C: Style/EmptyMethod: Put empty method definitions on a single line. (https://rubystyle.guide#no-single-line-methods) def test_suse ... ^^^^^^^^^^^^^ 7 files inspected, 12 offenses detected, 8 offenses auto-correctable ```
1 parent f88fdf7 commit 1a4d208

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

test/integration/default/controls/config_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
# frozen_string_literal: true
2+
13
control 'Php configuration' do
24
title 'should match desired lines'
35

6+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
47
def test_debian
58
describe file('/etc/php/5.6/fpm/pool.d/radius-admin.conf') do
69
its('content') { should include '[radius-admin]' }
@@ -20,12 +23,11 @@ def test_debian
2023
its('content') { should include 'date.timezone = Europe/Paris' }
2124
end
2225
end
26+
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
2327

24-
def test_redhat
25-
end
28+
def test_redhat; end
2629

27-
def test_suse
28-
end
30+
def test_suse; end
2931

3032
case os[:family]
3133
when 'debian'

test/integration/default/controls/package_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
# frozen_string_literal: true
2+
13
control 'Php package' do
24
title 'should be installed'
35

6+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
47
def test_debian
58
describe package('php-imagick') do
69
it { should be_installed }
@@ -18,7 +21,6 @@ def test_debian
1821
bz2 cli curl fpm gd imap intl mbstring
1922
mysql readline xml zip
2023
].each do |pkg|
21-
2224
describe package("php5.6-#{pkg}") do
2325
it { should be_installed }
2426
end
@@ -28,6 +30,7 @@ def test_debian
2830
end
2931
end
3032
end
33+
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
3134

3235
def test_redhat
3336
describe package('php') do

test/integration/default/controls/service_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
control 'Php service' do
24
title 'should be running and enabled'
35

@@ -13,11 +15,9 @@ def test_debian
1315
end
1416
end
1517

16-
def test_redhat
17-
end
18+
def test_redhat; end
1819

19-
def test_suse
20-
end
20+
def test_suse; end
2121

2222
case os[:family]
2323
when 'debian'

0 commit comments

Comments
 (0)