From e4ef0ed2f873778efd9307ad0b8246956cd4b360 Mon Sep 17 00:00:00 2001 From: Jesse Scott Date: Fri, 20 Oct 2017 14:31:51 -0700 Subject: [PATCH] (MAINT) Fix up rubocop settings and clean up inconsistent indentation --- .gitignore | 5 ++ .rubocop.yml | 12 ++-- spec/acceptance/emit_json_options.rb | 66 +++++++++---------- spec/acceptance/lib/util.rb | 2 +- .../yard/parsers/puppet/parser_spec.rb | 8 +-- 5 files changed, 49 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index 93e8f9a..dae4b21 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,8 @@ Gemfile.lock ## YARD output /doc/ + +## Acceptance test artifacts +/log/ +/*.gem +/spec/acceptance/nodesets/ diff --git a/.rubocop.yml b/.rubocop.yml index ccd6d11..52d151a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -83,12 +83,12 @@ Metrics/ModuleLength: Style/WhileUntilModifier: Enabled: false -# DISABLED - the offender is just haskell envy -Lint/AmbiguousRegexpLiteral: +# DISABLED +Security/Eval: Enabled: false -# DISABLED -Lint/Eval: +# DISABLED - the offender is just haskell envy +Lint/AmbiguousRegexpLiteral: Enabled: false # DISABLED @@ -304,10 +304,10 @@ Style/IndentHash: Enabled: false Style/IndentationConsistency: - Enabled: false + Enabled: true Style/IndentationWidth: - Enabled: false + Enabled: true Style/EmptyLines: Enabled: false diff --git a/spec/acceptance/emit_json_options.rb b/spec/acceptance/emit_json_options.rb index 0c0c5f4..3e64874 100644 --- a/spec/acceptance/emit_json_options.rb +++ b/spec/acceptance/emit_json_options.rb @@ -5,37 +5,37 @@ require 'json' include PuppetStrings::Acceptance::Util describe 'Emitting JSON' do -expected = { - "puppet_classes" => [], - "defined_types" => [], - "resource_types" => [], - "providers" => [], - "puppet_functions" => [ - "name" => "function3x", - "file" => "/etc/puppet/modules/test/lib/puppet/parser/functions/function3x.rb", - "line" => 1, - "type" => "ruby3x", - "signatures" => [ - { - "signature" =>"function3x()", - "docstring" => { - "text" => "This is the function documentation for `function3x`", - "tags" => [ - { - "tag_name"=>"return", - "text"=>"", - "types"=>["Any"] - } - ] - } - }, - ], - "docstring" => { - "text" => "This is the function documentation for `function3x`", - "tags" => ["tag_name" => "return", "text" => "", "types" => ["Any"]]}, - "source" => "Puppet::Parser::Functions.newfunction(:function3x, :doc => \"This is the function documentation for `function3x`\") do |args|\nend" - ] -} + expected = { + "puppet_classes" => [], + "defined_types" => [], + "resource_types" => [], + "providers" => [], + "puppet_functions" => [ + "name" => "function3x", + "file" => "/etc/puppet/modules/test/lib/puppet/parser/functions/function3x.rb", + "line" => 1, + "type" => "ruby3x", + "signatures" => [ + { + "signature" =>"function3x()", + "docstring" => { + "text" => "This is the function documentation for `function3x`", + "tags" => [ + { + "tag_name"=>"return", + "text"=>"", + "types"=>["Any"] + } + ] + } + }, + ], + "docstring" => { + "text" => "This is the function documentation for `function3x`", + "tags" => ["tag_name" => "return", "text" => "", "types" => ["Any"]]}, + "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 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/) tmpfile = master.tmpfile('json_output.json') on master, puppet('strings', 'generate', "--emit-json #{tmpfile}", "#{test_module_path}/lib/puppet/parser/functions/function3x.rb") - output = read_file_on(master, tmpfile) - expect(JSON.parse(output)).to eq(expected) + output = read_file_on(master, tmpfile) + expect(JSON.parse(output)).to eq(expected) end end diff --git a/spec/acceptance/lib/util.rb b/spec/acceptance/lib/util.rb index 9223472..6dc011a 100644 --- a/spec/acceptance/lib/util.rb +++ b/spec/acceptance/lib/util.rb @@ -75,7 +75,7 @@ A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y -----END CERTIFICATE----- EOM -GLOBALSIGN_CA = <<-EOM + GLOBALSIGN_CA = <<-EOM -----BEGIN CERTIFICATE----- MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv diff --git a/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb b/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb index 2778dd1..c59ec28 100644 --- a/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb +++ b/spec/unit/puppet-strings/yard/parsers/puppet/parser_spec.rb @@ -170,14 +170,14 @@ SOURCE end describe 'parsing puppet functions with return type in defintion', if: TEST_FUNCTION_RETURN_TYPE do - let(:source) { <> String { notice world } SOURCE - } + } it 'should parse the puppet function statement' do subject.parse @@ -189,14 +189,14 @@ SOURCE end describe 'parsing puppet functions with complex return types in defintion', if: TEST_FUNCTION_RETURN_TYPE do - let(:source) { <> Struct[{'a' => Integer[1, 10]}] { notice world } SOURCE - } + } it 'should parse the puppet function statement' do subject.parse