(MAINT) Fix up rubocop settings and clean up inconsistent indentation

This commit is contained in:
Jesse Scott 2017-10-20 14:31:51 -07:00
parent 99efcb156a
commit e4ef0ed2f8
5 changed files with 49 additions and 44 deletions

5
.gitignore vendored
View File

@ -33,3 +33,8 @@ Gemfile.lock
## YARD output ## YARD output
/doc/ /doc/
## Acceptance test artifacts
/log/
/*.gem
/spec/acceptance/nodesets/

View File

@ -83,12 +83,12 @@ Metrics/ModuleLength:
Style/WhileUntilModifier: Style/WhileUntilModifier:
Enabled: false Enabled: false
# DISABLED - the offender is just haskell envy # DISABLED
Lint/AmbiguousRegexpLiteral: Security/Eval:
Enabled: false Enabled: false
# DISABLED # DISABLED - the offender is just haskell envy
Lint/Eval: Lint/AmbiguousRegexpLiteral:
Enabled: false Enabled: false
# DISABLED # DISABLED
@ -304,10 +304,10 @@ Style/IndentHash:
Enabled: false Enabled: false
Style/IndentationConsistency: Style/IndentationConsistency:
Enabled: false Enabled: true
Style/IndentationWidth: Style/IndentationWidth:
Enabled: false Enabled: true
Style/EmptyLines: Style/EmptyLines:
Enabled: false Enabled: false

View File

@ -5,37 +5,37 @@ require 'json'
include PuppetStrings::Acceptance::Util include PuppetStrings::Acceptance::Util
describe 'Emitting JSON' do describe 'Emitting JSON' do
expected = { expected = {
"puppet_classes" => [], "puppet_classes" => [],
"defined_types" => [], "defined_types" => [],
"resource_types" => [], "resource_types" => [],
"providers" => [], "providers" => [],
"puppet_functions" => [ "puppet_functions" => [
"name" => "function3x", "name" => "function3x",
"file" => "/etc/puppet/modules/test/lib/puppet/parser/functions/function3x.rb", "file" => "/etc/puppet/modules/test/lib/puppet/parser/functions/function3x.rb",
"line" => 1, "line" => 1,
"type" => "ruby3x", "type" => "ruby3x",
"signatures" => [ "signatures" => [
{ {
"signature" =>"function3x()", "signature" =>"function3x()",
"docstring" => { "docstring" => {
"text" => "This is the function documentation for `function3x`", "text" => "This is the function documentation for `function3x`",
"tags" => [ "tags" => [
{ {
"tag_name"=>"return", "tag_name"=>"return",
"text"=>"", "text"=>"",
"types"=>["Any"] "types"=>["Any"]
} }
] ]
} }
}, },
], ],
"docstring" => { "docstring" => {
"text" => "This is the function documentation for `function3x`", "text" => "This is the function documentation for `function3x`",
"tags" => ["tag_name" => "return", "text" => "", "types" => ["Any"]]}, "tags" => ["tag_name" => "return", "text" => "", "types" => ["Any"]]},
"source" => "Puppet::Parser::Functions.newfunction(:function3x, :doc => \"This is the function documentation for `function3x`\") do |args|\nend" "source" => "Puppet::Parser::Functions.newfunction(:function3x, :doc => \"This is the function documentation for `function3x`\") do |args|\nend"
] ]
} }
it 'should emit JSON to stdout when using the --emit-json-stdout option' do it 'should emit JSON to stdout when using the --emit-json-stdout option' do
test_module_path = get_test_module_path(master, /Module test/) test_module_path = get_test_module_path(master, /Module test/)
@ -49,7 +49,7 @@ expected = {
test_module_path = get_test_module_path(master, /Module test/) test_module_path = get_test_module_path(master, /Module test/)
tmpfile = master.tmpfile('json_output.json') tmpfile = master.tmpfile('json_output.json')
on master, puppet('strings', 'generate', "--emit-json #{tmpfile}", "#{test_module_path}/lib/puppet/parser/functions/function3x.rb") on master, puppet('strings', 'generate', "--emit-json #{tmpfile}", "#{test_module_path}/lib/puppet/parser/functions/function3x.rb")
output = read_file_on(master, tmpfile) output = read_file_on(master, tmpfile)
expect(JSON.parse(output)).to eq(expected) expect(JSON.parse(output)).to eq(expected)
end end
end end

View File

@ -75,7 +75,7 @@ A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
-----END CERTIFICATE----- -----END CERTIFICATE-----
EOM EOM
GLOBALSIGN_CA = <<-EOM GLOBALSIGN_CA = <<-EOM
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv

View File

@ -170,14 +170,14 @@ SOURCE
end end
describe 'parsing puppet functions with return type in defintion', if: TEST_FUNCTION_RETURN_TYPE do describe 'parsing puppet functions with return type in defintion', if: TEST_FUNCTION_RETURN_TYPE do
let(:source) { <<SOURCE let(:source) { <<SOURCE
# A simple foo function. # A simple foo function.
# @return Returns a string # @return Returns a string
function foo() >> String { function foo() >> String {
notice world notice world
} }
SOURCE SOURCE
} }
it 'should parse the puppet function statement' do it 'should parse the puppet function statement' do
subject.parse subject.parse
@ -189,14 +189,14 @@ SOURCE
end end
describe 'parsing puppet functions with complex return types in defintion', if: TEST_FUNCTION_RETURN_TYPE do describe 'parsing puppet functions with complex return types in defintion', if: TEST_FUNCTION_RETURN_TYPE do
let(:source) { <<SOURCE let(:source) { <<SOURCE
# A simple foo function. # A simple foo function.
# @return Returns a struct with a hash including one key which must be an integer between 1 and 10. # @return Returns a struct with a hash including one key which must be an integer between 1 and 10.
function foo() >> Struct[{'a' => Integer[1, 10]}] { function foo() >> Struct[{'a' => Integer[1, 10]}] {
notice world notice world
} }
SOURCE SOURCE
} }
it 'should parse the puppet function statement' do it 'should parse the puppet function statement' do
subject.parse subject.parse