use single quotes

This commit is contained in:
Christoph Hartmann 2015-09-03 23:18:28 +02:00
parent 5c137a7ab1
commit 1773d20178
20 changed files with 51 additions and 51 deletions

View file

@ -16,7 +16,7 @@ class AuditDaemonConf < Vulcano.resource(1)
end
def to_s
"audit daemon configuration file"
'audit daemon configuration file'
end
def method_missing(name)

View file

@ -6,7 +6,7 @@ class AuditDaemonRules < Vulcano.resource(1)
name 'audit_daemon_rules'
def initialize
@content = vulcano.run_command("/sbin/auditctl -l").stdout.chomp
@content = vulcano.run_command('/sbin/auditctl -l').stdout.chomp
@opts = {
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
@ -27,7 +27,7 @@ class AuditDaemonRules < Vulcano.resource(1)
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
multiple_values: false
}
@status_content ||= vulcano.run_command("/sbin/auditctl -s").stdout.chomp
@status_content ||= vulcano.run_command('/sbin/auditctl -s').stdout.chomp
@status_params = SimpleConfig.new(@status_content, @status_opts).params
status = @status_params['AUDIT_STATUS']
if (status == nil) then return nil end

View file

@ -16,7 +16,7 @@ class InetdConf < Vulcano.resource(1)
end
def to_s
"inetd_conf"
'inetd_conf'
end
def method_missing(name)

View file

@ -16,7 +16,7 @@ class LimitsConf < Vulcano.resource(1)
end
def to_s
"limits_conf"
'limits_conf'
end
def method_missing(name)

View file

@ -16,7 +16,7 @@ class LoginDef < Vulcano.resource(1)
end
def to_s
"login_def"
'login_def'
end
def method_missing(name)

View file

@ -56,7 +56,7 @@ class MysqlConf < Vulcano.resource(1)
end
def read_content
@content = ""
@content = ''
@params = {}
# skip if the main configuration file doesn't exist

View file

@ -16,7 +16,7 @@ class NtpConf < Vulcano.resource(1)
end
def to_s
"ntp_conf"
'ntp_conf'
end
def method_missing(name)

View file

@ -71,13 +71,13 @@ class Passwd < Vulcano.resource(1)
def users
@parsed.map {|x|
{
"name" => x.at(0),
"password" => x.at(1),
"uid" => x.at(2),
"gid" => x.at(3),
"desc" => x.at(4),
"home" => x.at(5),
"shell" => x.at(6)
'name' => x.at(0),
'password' => x.at(1),
'uid' => x.at(2),
'gid' => x.at(3),
'desc' => x.at(4),
'home' => x.at(5),
'shell' => x.at(6)
}
}
end

View file

@ -32,7 +32,7 @@ class PostgresConf < Vulcano.resource(1)
end
def read_content
@content = ""
@content = ''
@params = {}
# skip if the main configuration file doesn't exist

View file

@ -39,7 +39,7 @@ class PostgresSession
out.downcase =~ /^error/
# skip this test if the server can't run the query
RSpec.describe( cmd ) do
it "is skipped", skip: out do
it 'is skipped', skip: out do
end
end
else

View file

@ -45,7 +45,7 @@ class SecurityPolicy < Vulcano.resource(1)
# find line with key
key = method.to_s
target = ""
target = ''
@@policy.each_line {|s|
target = s.strip if s.match(/\b#{key}\s*=\s*(.*)\b/)
}

View file

@ -14,8 +14,8 @@ module DummyTestTypes
def command(sth)
res = OpenStruct.new
res.stdout = ""
res.stderr = ""
res.stdout = ''
res.stderr = ''
res
end
end

View file

@ -40,12 +40,12 @@ module Vulcano
is_valid = true
err = lambda{|msg| @log.error msg; is_valid = false }
warn = lambda{|msg| @log.warn msg; is_valid = false }
err.("Missing profile name in vmetadata.rb") if @dict['name'].nil?
err.("Missing profile title in vmetadata.rb") if @dict['title'].nil?
err.("Missing profile version in vmetadata.rb") if @dict['version'].nil?
err.("Missing summary in vmetadata.rb") if @dict['summary'].nil?
warn.("Missing maintainer in vmetadata.rb") if @dict['maintainer'].nil?
warn.("Missing copyright in vmetadata.rb") if @dict['copyright'].nil?
err.('Missing profile name in vmetadata.rb') if @dict['name'].nil?
err.('Missing profile title in vmetadata.rb') if @dict['title'].nil?
err.('Missing profile version in vmetadata.rb') if @dict['version'].nil?
err.('Missing summary in vmetadata.rb') if @dict['summary'].nil?
warn.('Missing maintainer in vmetadata.rb') if @dict['maintainer'].nil?
warn.('Missing copyright in vmetadata.rb') if @dict['copyright'].nil?
is_valid
end

View file

@ -29,11 +29,11 @@ module Vulcano
if !File.directory? path
return @log.error "This is not a folder: #{path}"
else
@log.ok "Valid directory"
@log.ok 'Valid directory'
end
metadata = Metadata.for_path(path, @profile_id)
@log.ok "vmetadata.rb" unless metadata.nil? or !metadata.valid?
@log.ok 'vmetadata.rb' unless metadata.nil? or !metadata.valid?
specs = Dir["#{path}/spec/*_spec.rb"]
if specs.empty?

View file

@ -95,9 +95,9 @@ module Vulcano
def metadata
header = @raw.sub(/^[^#].*\Z/m,'')
{
"title" => mOr(header.match(/^# title: (.*)$/), @filename),
"copyright" => mOr(header.match(/^# copyright: (.*)$/), 'All rights reserved'),
"rules" => rules2dict(@rules)
'title' => mOr(header.match(/^# title: (.*)$/), @filename),
'copyright' => mOr(header.match(/^# copyright: (.*)$/), 'All rights reserved'),
'rules' => rules2dict(@rules)
}
end
@ -115,10 +115,10 @@ module Vulcano
d = nil
d = rule.desc.gsub(/\s*\n\s*/, ' ').strip unless rule.desc.nil?
{
"impact" => rule.impact,
"title" => rule.title,
"desc" => d,
"code" => rule.instance_variable_get(:@__code)
'impact' => rule.impact,
'title' => rule.title,
'desc' => d,
'code' => rule.instance_variable_get(:@__code)
}
end

View file

@ -31,7 +31,7 @@ module Vulcano
def self.backend(version = 1)
if version != 1
raise "Only backend version 1 is supported!"
fail 'Only backend version 1 is supported!'
end
Vulcano::Plugins::Backend
end

View file

@ -109,7 +109,7 @@ module Vulcano::Backends
ssh_opts[:auth_methods].push('password')
end
if ssh_opts[:keys].empty? and ssh_opts[:password].nil?
raise "You must configure at least one authentication method" +
fail "You must configure at least one authentication method" +
": Password or key."
end

View file

@ -6,7 +6,7 @@ class VulcanoBaseRule
def initialize(id, opts, &block)
@id = id
@impact = nil
@__code = ""
@__code = ''
@__block = block
@title = nil
@desc = nil

View file

@ -8,8 +8,8 @@ module Vulcano
attr_reader :rules, :only_ifs
def initialize(profile_id, backend, profile_registry: {}, only_ifs: [])
if backend.nil?
raise "ProfileContext is initiated with a backend == nil. " +
"This is a backend error which must be fixed upstream."
fail 'ProfileContext is initiated with a backend == nil. ' +
'This is a backend error which must be fixed upstream.'
end
@profile_id = profile_id

View file

@ -4,25 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'vulcano/version'
Gem::Specification.new do |spec|
spec.name = "vulcano"
spec.name = 'vulcano'
spec.version = Vulcano::VERSION
spec.authors = ["Dominik Richter"]
spec.email = ["dominik@vulcanosec.com"]
spec.authors = ['Dominik Richter']
spec.email = ['dominik@vulcanosec.com']
spec.summary = %q{Validate Vulcano compliance checks.}
spec.description = %q{Validate Vulcano compliance checks.}
spec.homepage = "https://github.com/..."
spec.license = "Proprietary"
spec.homepage = 'https://github.com/...'
spec.license = 'Proprietary'
spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.require_paths = ['lib']
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "minitest", "~> 5.5"
spec.add_development_dependency "rspec", "~> 3.3"
spec.add_development_dependency "rake", "~> 10"
spec.add_development_dependency "pry", "~> 0.10"
spec.add_development_dependency 'bundler', '~> 1.5'
spec.add_development_dependency 'minitest', '~> 5.5'
spec.add_development_dependency 'rspec', '~> 3.3'
spec.add_development_dependency 'rake', '~> 10'
spec.add_development_dependency 'pry', '~> 0.10'
spec.add_development_dependency 'rubocop', '~> 0.33.0'
spec.add_dependency 'thor', '~> 0.19'