Skip to content

Commit 981664b

Browse files
authored
Merge pull request #11 from dev-sec/fix_lint
Fix lint
2 parents 1769100 + 3f11332 commit 981664b

File tree

4 files changed

+36
-17
lines changed

4 files changed

+36
-17
lines changed

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ Metrics/PerceivedComplexity:
2626
Max: 10
2727
Metrics/AbcSize:
2828
Max: 30
29+
# Lint/AmbiguousBlockAssociation is incompatible with RSpec
30+
# https://github.com/rubocop-hq/rubocop/issues/4222
31+
Lint/AmbiguousBlockAssociation:
32+
Enabled: false

Rakefile

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

43
require 'rake/testtask'
54
require 'rubocop/rake_task'
@@ -20,23 +19,30 @@ task default: [:lint, 'test:check']
2019
namespace :test do
2120
# run inspec check to verify that the profile is properly configured
2221
task :check do
23-
dir = File.join(File.dirname(__FILE__))
24-
sh("bundle exec inspec check #{dir}")
22+
require 'inspec'
23+
puts "Checking profile with InSpec Version: #{Inspec::VERSION}"
24+
profile = Inspec::Profile.for_target('.', backend: Inspec::Backend.create(Inspec::Config.mock))
25+
pp profile.check
2526
end
2627
end
2728

28-
# Automatically generate a changelog for this project. Only loaded if
29-
# the necessary gem is installed. By default its picking up the version from
30-
# inspec.yml. You can override that behavior with s`rake changelog to=1.2.0`
31-
begin
32-
require 'yaml'
33-
metadata = YAML.load_file('inspec.yml')
34-
v = ENV['to'] || metadata['version']
35-
puts "Generate changelog for version #{v}"
36-
require 'github_changelog_generator/task'
37-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
38-
config.future_release = v
29+
task :changelog do
30+
# Automatically generate a changelog for this project. Only loaded if
31+
# the necessary gem is installed. By default its picking up the version from
32+
# inspec.yml. You can override that behavior with `rake changelog to=1.2.0`
33+
begin
34+
require 'yaml'
35+
metadata = YAML.load_file('inspec.yml')
36+
v = ENV['to'] || metadata['version']
37+
puts " * Generating changelog for version #{v}"
38+
require 'github_changelog_generator/task'
39+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
40+
config.future_release = v
41+
config.user = 'dev-sec'
42+
config.project = 'php-baseline'
43+
end
44+
Rake::Task[:changelog].execute
45+
rescue LoadError
46+
puts '>>>>> GitHub Changelog Generator not loaded, omitting tasks'
3947
end
40-
rescue LoadError
41-
puts '>>>>> GitHub Changelog Generator not loaded, omitting tasks'
4248
end

controls/php_conf.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# encoding: utf-8
2+
# frozen_string_literal: true
3+
24
#
35
# Copyright 2015, Dominik Richter
46
# Copyright 2016, Christoph Hartmann

libraries/php.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# encoding: utf-8
2+
# frozen_string_literal: true
3+
24
#
35
# Copyright 2016, Christoph Hartmann
46
#
@@ -33,6 +35,7 @@ class PHP < Inspec.resource(1)
3335
"
3436

3537
def initialize(options = {})
38+
super()
3639
@options = options
3740
end
3841

@@ -49,13 +52,15 @@ def config(param)
4952
def extension(extension)
5053
ext = Class.new do
5154
def initialize(parent, extension)
55+
super
5256
@parent = parent
5357
@extension = extension
5458
end
5559

5660
def loaded?
5761
cmd = @parent._run("#{@parent._php_executable} --ri '#{@extension}'")
5862
return true if cmd.exit_status.zero?
63+
5964
false
6065
end
6166

@@ -90,6 +95,7 @@ class PHPConfig < PHP
9095
"
9196

9297
def initialize(param)
98+
super()
9399
warn '[DEPRECATION] `php_config(param)` is deprecated. Please use `php.config(param)` instead.'
94100
@param = param
95101
end
@@ -118,6 +124,7 @@ class PHPExtension < PHP
118124
"
119125

120126
def initialize(extension)
127+
super
121128
warn '[DEPRECATION] `php_extension(ext)` is deprecated. Please use `php.extension(ext)` instead.'
122129
@extension = extension
123130
end

0 commit comments

Comments
 (0)