Skip to content

Commit eccb958

Browse files
authored
Merge pull request #56 from dev-sec/newlint
Change linting to Cookstyle
2 parents 0ab38d0 + 06789a7 commit eccb958

File tree

5 files changed

+8
-36
lines changed

5 files changed

+8
-36
lines changed

.rubocop.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,3 @@
22
AllCops:
33
Exclude:
44
- vendor/**/*
5-
Documentation:
6-
Enabled: false
7-
Layout/ParameterAlignment:
8-
Enabled: true
9-
HashSyntax:
10-
Enabled: true
11-
LineLength:
12-
Enabled: false
13-
EmptyLinesAroundBlockBody:
14-
Enabled: false
15-
Style/Encoding:
16-
Enabled: false
17-
MethodLength:
18-
Max: 40
19-
NumericLiterals:
20-
MinDigits: 10
21-
Metrics/BlockLength:
22-
Max: 35
23-
Metrics/CyclomaticComplexity:
24-
Max: 10
25-
Metrics/PerceivedComplexity:
26-
Max: 10
27-
Metrics/AbcSize:
28-
Max: 30
29-
# Lint/AmbiguousBlockAssociation is incompatible with RSpec
30-
# https://github.com/rubocop-hq/rubocop/issues/4222
31-
Lint/AmbiguousBlockAssociation:
32-
Enabled: false

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
source 'https://rubygems.org'
44

5+
gem 'cookstyle'
56
gem 'highline'
67
gem 'rack'
78
gem 'rake'

Rakefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env rake
2-
# encoding: utf-8
32
# frozen_string_literal: true
43

4+
require 'cookstyle'
55
require 'rake/testtask'
66
require 'rubocop/rake_task'
77

@@ -11,6 +11,10 @@ task :rubocop do
1111
RuboCop::RakeTask.new
1212
end
1313

14+
RuboCop::RakeTask.new(:cookstyle) do |task|
15+
task.options << '--display-cop-names'
16+
end
17+
1418
# lint the project
1519
desc 'Run robocop linter'
1620
task lint: [:rubocop]
@@ -46,5 +50,4 @@ task :changelog do
4650
Rake::Task[:changelog].execute
4751
rescue LoadError
4852
puts '>>>>> GitHub Changelog Generator not loaded, omitting tasks'
49-
5053
end

controls/patches.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# encoding: utf-8
21
# frozen_string_literal: true
32

43
# copyright: 2016, Christoph Hartmann

libraries/linux_updates.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# encoding: utf-8
21
# frozen_string_literal: true
32

43
# copyright: 2016, Christoph Hartmann
@@ -49,7 +48,7 @@ def updates
4948
end
5049

5150
def uptodate?
52-
return nil if @update_mgmt.nil?
51+
return if @update_mgmt.nil?
5352

5453
u = @update_mgmt.updates
5554
return false if u.nil? || !u['available'].empty?
@@ -198,7 +197,6 @@ def debian_base
198197

199198
class RHELUpdateFetcher < UpdateFetcher
200199
def packages
201-
# rubocop:disable Style/FormatStringToken
202200
rhel_packages = <<~PRINT_JSON
203201
sleep 2 && echo " "
204202
echo -n '{"installed":['
@@ -207,7 +205,6 @@ def packages
207205
echo -n ']}'
208206
PRINT_JSON
209207
parse_json(rhel_packages)
210-
# rubocop:enable Style/FormatStringToken
211208
end
212209

213210
def updates
@@ -219,7 +216,7 @@ def updates
219216
unless cmd.exit_status.zero?
220217
# essentially we want https://github.com/chef/inspec/issues/1205
221218
warn 'Could not determine patch status.'
222-
return nil
219+
return
223220
end
224221

225222
first = cmd.stdout.index('{')

0 commit comments

Comments
 (0)