]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Update modulesync_config [a3fe424]
authorDavid Schmitt <david.schmitt@puppet.com>
Fri, 26 Aug 2016 07:28:58 +0000 (09:28 +0200)
committerDavid Schmitt <david.schmitt@puppet.com>
Fri, 26 Aug 2016 16:42:08 +0000 (18:42 +0200)
.rubocop.yml [new file with mode: 0644]
.travis.yml
Gemfile
Rakefile
spec/acceptance/nodesets/centos-7-x64.yml

diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644 (file)
index 0000000..5aadd1b
--- /dev/null
@@ -0,0 +1,508 @@
+require: rubocop-rspec
+AllCops:
+  TargetRubyVersion: 1.9
+  Include:
+    - ./**/*.rb
+  Exclude:
+    - vendor/**/*
+    - .vendor/**/*
+    - pkg/**/*
+    - spec/fixtures/**/*
+Lint/ConditionPosition:
+  Enabled: True
+
+Lint/ElseLayout:
+  Enabled: True
+
+Lint/UnreachableCode:
+  Enabled: True
+
+Lint/UselessComparison:
+  Enabled: True
+
+Lint/EnsureReturn:
+  Enabled: True
+
+Lint/HandleExceptions:
+  Enabled: True
+
+Lint/LiteralInCondition:
+  Enabled: True
+
+Lint/ShadowingOuterLocalVariable:
+  Enabled: True
+
+Lint/LiteralInInterpolation:
+  Enabled: True
+
+Style/HashSyntax:
+  Enabled: True
+
+Style/RedundantReturn:
+  Enabled: True
+
+Lint/AmbiguousOperator:
+  Enabled: True
+
+Lint/AssignmentInCondition:
+  Enabled: True
+
+Style/SpaceBeforeComment:
+  Enabled: True
+
+Style/AndOr:
+  Enabled: True
+
+Style/RedundantSelf:
+  Enabled: True
+
+# Method length is not necessarily an indicator of code quality
+Metrics/MethodLength:
+  Enabled: False
+
+# Module length is not necessarily an indicator of code quality
+Metrics/ModuleLength:
+  Enabled: False
+
+Style/WhileUntilModifier:
+  Enabled: True
+
+Lint/AmbiguousRegexpLiteral:
+  Enabled: True
+
+Lint/Eval:
+  Enabled: True
+
+Lint/BlockAlignment:
+  Enabled: True
+
+Lint/DefEndAlignment:
+  Enabled: True
+
+Lint/EndAlignment:
+  Enabled: True
+
+Lint/DeprecatedClassMethods:
+  Enabled: True
+
+Lint/Loop:
+  Enabled: True
+
+Lint/ParenthesesAsGroupedExpression:
+  Enabled: True
+
+Lint/RescueException:
+  Enabled: True
+
+Lint/StringConversionInInterpolation:
+  Enabled: True
+
+Lint/UnusedBlockArgument:
+  Enabled: True
+
+Lint/UnusedMethodArgument:
+  Enabled: True
+
+Lint/UselessAccessModifier:
+  Enabled: True
+
+Lint/UselessAssignment:
+  Enabled: True
+
+Lint/Void:
+  Enabled: True
+
+Style/AccessModifierIndentation:
+  Enabled: True
+
+Style/AccessorMethodName:
+  Enabled: True
+
+Style/Alias:
+  Enabled: True
+
+Style/AlignArray:
+  Enabled: True
+
+Style/AlignHash:
+  Enabled: True
+
+Style/AlignParameters:
+  Enabled: True
+
+Metrics/BlockNesting:
+  Enabled: True
+
+Style/AsciiComments:
+  Enabled: True
+
+Style/Attr:
+  Enabled: True
+
+Style/BracesAroundHashParameters:
+  Enabled: True
+
+Style/CaseEquality:
+  Enabled: True
+
+Style/CaseIndentation:
+  Enabled: True
+
+Style/CharacterLiteral:
+  Enabled: True
+
+Style/ClassAndModuleCamelCase:
+  Enabled: True
+
+Style/ClassAndModuleChildren:
+  Enabled: False
+
+Style/ClassCheck:
+  Enabled: True
+
+# Class length is not necessarily an indicator of code quality
+Metrics/ClassLength:
+  Enabled: False
+
+Style/ClassMethods:
+  Enabled: True
+
+Style/ClassVars:
+  Enabled: True
+
+Style/WhenThen:
+  Enabled: True
+
+Style/WordArray:
+  Enabled: True
+
+Style/UnneededPercentQ:
+  Enabled: True
+
+Style/Tab:
+  Enabled: True
+
+Style/SpaceBeforeSemicolon:
+  Enabled: True
+
+Style/TrailingBlankLines:
+  Enabled: True
+
+Style/SpaceInsideBlockBraces:
+  Enabled: True
+
+Style/SpaceInsideBrackets:
+  Enabled: True
+
+Style/SpaceInsideHashLiteralBraces:
+  Enabled: True
+
+Style/SpaceInsideParens:
+  Enabled: True
+
+Style/LeadingCommentSpace:
+  Enabled: True
+
+Style/SpaceBeforeFirstArg:
+  Enabled: True
+
+Style/SpaceAfterColon:
+  Enabled: True
+
+Style/SpaceAfterComma:
+  Enabled: True
+
+Style/SpaceAfterMethodName:
+  Enabled: True
+
+Style/SpaceAfterNot:
+  Enabled: True
+
+Style/SpaceAfterSemicolon:
+  Enabled: True
+
+Style/SpaceAroundEqualsInParameterDefault:
+  Enabled: True
+
+Style/SpaceAroundOperators:
+  Enabled: True
+
+Style/SpaceBeforeBlockBraces:
+  Enabled: True
+
+Style/SpaceBeforeComma:
+  Enabled: True
+
+Style/CollectionMethods:
+  Enabled: True
+
+Style/CommentIndentation:
+  Enabled: True
+
+Style/ColonMethodCall:
+  Enabled: True
+
+Style/CommentAnnotation:
+  Enabled: True
+
+# 'Complexity' is very relative
+Metrics/CyclomaticComplexity:
+  Enabled: False
+
+Style/ConstantName:
+  Enabled: True
+
+Style/Documentation:
+  Enabled: False
+
+Style/DefWithParentheses:
+  Enabled: True
+
+Style/PreferredHashMethods:
+  Enabled: True
+
+Style/DotPosition:
+  EnforcedStyle: trailing
+
+Style/DoubleNegation:
+  Enabled: True
+
+Style/EachWithObject:
+  Enabled: True
+
+Style/EmptyLineBetweenDefs:
+  Enabled: True
+
+Style/IndentArray:
+  Enabled: True
+
+Style/IndentHash:
+  Enabled: True
+
+Style/IndentationConsistency:
+  Enabled: True
+
+Style/IndentationWidth:
+  Enabled: True
+
+Style/EmptyLines:
+  Enabled: True
+
+Style/EmptyLinesAroundAccessModifier:
+  Enabled: True
+
+Style/EmptyLiteral:
+  Enabled: True
+
+# Configuration parameters: AllowURI, URISchemes.
+Metrics/LineLength:
+  Enabled: False
+
+Style/MethodCallParentheses:
+  Enabled: True
+
+Style/MethodDefParentheses:
+  Enabled: True
+
+Style/LineEndConcatenation:
+  Enabled: True
+
+Style/TrailingWhitespace:
+  Enabled: True
+
+Style/StringLiterals:
+  Enabled: True
+
+Style/TrailingCommaInArguments:
+  Enabled: True
+
+Style/TrailingCommaInLiteral:
+  Enabled: True
+
+Style/GlobalVars:
+  Enabled: True
+
+Style/GuardClause:
+  Enabled: True
+
+Style/IfUnlessModifier:
+  Enabled: True
+
+Style/MultilineIfThen:
+  Enabled: True
+
+Style/NegatedIf:
+  Enabled: True
+
+Style/NegatedWhile:
+  Enabled: True
+
+Style/Next:
+  Enabled: True
+
+Style/SingleLineBlockParams:
+  Enabled: True
+
+Style/SingleLineMethods:
+  Enabled: True
+
+Style/SpecialGlobalVars:
+  Enabled: True
+
+Style/TrivialAccessors:
+  Enabled: True
+
+Style/UnlessElse:
+  Enabled: True
+
+Style/VariableInterpolation:
+  Enabled: True
+
+Style/VariableName:
+  Enabled: True
+
+Style/WhileUntilDo:
+  Enabled: True
+
+Style/EvenOdd:
+  Enabled: True
+
+Style/FileName:
+  Enabled: True
+
+Style/For:
+  Enabled: True
+
+Style/Lambda:
+  Enabled: True
+
+Style/MethodName:
+  Enabled: True
+
+Style/MultilineTernaryOperator:
+  Enabled: True
+
+Style/NestedTernaryOperator:
+  Enabled: True
+
+Style/NilComparison:
+  Enabled: True
+
+Style/FormatString:
+  Enabled: True
+
+Style/MultilineBlockChain:
+  Enabled: True
+
+Style/Semicolon:
+  Enabled: True
+
+Style/SignalException:
+  Enabled: True
+
+Style/NonNilCheck:
+  Enabled: True
+
+Style/Not:
+  Enabled: True
+
+Style/NumericLiterals:
+  Enabled: True
+
+Style/OneLineConditional:
+  Enabled: True
+
+Style/OpMethod:
+  Enabled: True
+
+Style/ParenthesesAroundCondition:
+  Enabled: True
+
+Style/PercentLiteralDelimiters:
+  Enabled: True
+
+Style/PerlBackrefs:
+  Enabled: True
+
+Style/PredicateName:
+  Enabled: True
+
+Style/RedundantException:
+  Enabled: True
+
+Style/SelfAssignment:
+  Enabled: True
+
+Style/Proc:
+  Enabled: True
+
+Style/RaiseArgs:
+  Enabled: True
+
+Style/RedundantBegin:
+  Enabled: True
+
+Style/RescueModifier:
+  Enabled: True
+
+# based on https://github.com/voxpupuli/modulesync_config/issues/168
+Style/RegexpLiteral:
+  EnforcedStyle: percent_r
+  Enabled: True
+
+Lint/UnderscorePrefixedVariableName:
+  Enabled: True
+
+Metrics/ParameterLists:
+  Enabled: False
+
+Lint/RequireParentheses:
+  Enabled: True
+
+Style/SpaceBeforeFirstArg:
+  Enabled: True
+
+Style/ModuleFunction:
+  Enabled: True
+
+Lint/Debugger:
+  Enabled: True
+
+Style/IfWithSemicolon:
+  Enabled: True
+
+Style/Encoding:
+  Enabled: True
+
+Style/BlockDelimiters:
+  Enabled: True
+
+Style/MultilineBlockLayout:
+  Enabled: True
+
+# 'Complexity' is very relative
+Metrics/AbcSize:
+  Enabled: False
+
+# 'Complexity' is very relative
+Metrics/PerceivedComplexity:
+  Enabled: False
+
+Lint/UselessAssignment:
+  Enabled: True
+
+Style/ClosingParenthesisIndentation:
+  Enabled: False
+
+# RSpec
+
+# We don't use rspec in this way
+RSpec/DescribeClass:
+  Enabled: False
+
+# Example length is not necessarily an indicator of code quality
+RSpec/ExampleLength:
+  Enabled: False
+
+RSpec/NamedSubject:
+  Enabled: False
index 8a2b7ffdbf1419f676079454824ae076bc62b979..fa4159736250d6fcbd61bb21389645b148b5953a 100644 (file)
@@ -7,21 +7,24 @@ script: "bundle exec rake validate lint spec"
 matrix:
   fast_finish: true
   include:
-  - rvm: 2.1.6
+  - rvm: 2.3.1
     dist: trusty
     env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 SPEC_OPTS="--tag docker"
     script: bundle exec rake beaker
     services: docker
     sudo: required
-  - rvm: 2.1.6
+  - rvm: 2.3.1
     dist: trusty
     env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 SPEC_OPTS=""--tag docker"
     script: bundle exec rake beaker
     services: docker
     sudo: required
+  - rvm: 2.3.1
+    bundler_args: --without system_tests
+    env: PUPPET_GEM_VERSION="~> 4.0"
   - rvm: 2.1.9
     bundler_args: --without system_tests
-    env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
+    env: PUPPET_GEM_VERSION="~> 4.0"
   - rvm: 2.1.5
     bundler_args: --without system_tests
     env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
diff --git a/Gemfile b/Gemfile
index c7da908d9f70a0cb290ef5113fcb85cd7aaeeb8c..c97275bd828700b2148ee9557223f6861f15b299 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -2,39 +2,46 @@
 
 source ENV['GEM_SOURCE'] || "https://rubygems.org"
 
-def location_for(place, version = nil)
-  if place =~ /^(git[:@][^#]*)#(.*)/
-    [version, { :git => $1, :branch => $2, :require => false}].compact
-  elsif place =~ /^file:\/\/(.*)/
-    ['>= 0', { :path => File.expand_path($1), :require => false}]
+def location_from_env(env, default_location = [])
+  if location = ENV[env]
+    if location =~ /^((?:git|https?)[:@][^#]*)#(.*)/
+      [{ :git => $1, :branch => $2, :require => false }]
+    elsif location =~ /^file:\/\/(.*)/
+      ['>= 0', { :path => File.expand_path($1), :require => false }]
+    else
+      [location, { :require => false }]
+    end
   else
-    [place, version, { :require => false}].compact
+    default_location
   end
 end
 
 group :development, :unit_tests do
-  gem 'metadata-json-lint',             :require => false
-  gem 'puppet_facts',                   :require => false
-  gem 'puppet-blacksmith', '>= 3.4.0',  :require => false
-  gem 'puppetlabs_spec_helper',         :require => false
-  gem 'rspec-puppet', '>= 2.3.2',       :require => false
-  gem 'simplecov',                      :require => false
+  gem 'metadata-json-lint'
+  gem 'puppet_facts'
+  gem 'puppet-blacksmith', '>= 3.4.0'
+  gem 'puppetlabs_spec_helper', '>= 1.2.1'
+  gem 'rspec-puppet', '>= 2.3.2'
+  gem 'rspec-puppet-facts'
+  gem 'simplecov'
+  gem 'parallel_tests'
+  gem 'rubocop', '0.41.2' if RUBY_VERSION < '2.0.0'
+  gem 'rubocop' if RUBY_VERSION >= '2.0.0'
+  gem 'rubocop-rspec', '~> 1.6' if RUBY_VERSION >= '2.3.0'
+  gem 'json_pure', '<= 2.0.1' if RUBY_VERSION < '2.0.0'
 end
 group :system_tests do
-  gem 'beaker-rspec',                  *location_for(ENV['BEAKER_RSPEC_VERSION'] || '>= 3.4')
-  gem 'beaker',                        *location_for(ENV['BEAKER_VERSION'])
-  gem 'serverspec',                    :require => false
-  gem 'beaker-puppet_install_helper',  :require => false
-  gem 'master_manipulator',            :require => false
-  gem 'beaker-hostgenerator',          *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
+  gem 'beaker', *location_from_env('BEAKER_VERSION', []) if RUBY_VERSION >= '2.3.0'
+  gem 'beaker', *location_from_env('BEAKER_VERSION', ['< 3']) if RUBY_VERSION < '2.3.0'
+  gem 'beaker-rspec', *location_from_env('BEAKER_RSPEC_VERSION', ['>= 3.4'])
+  gem 'serverspec'
+  gem 'beaker-puppet_install_helper'
+  gem 'master_manipulator'
+  gem 'beaker-hostgenerator', *location_from_env('BEAKER_HOSTGENERATOR_VERSION', [])
 end
 
-# json_pure 2.0.2 added a requirement on ruby >= 2. We pin to json_pure 2.0.1
-# if using ruby 1.x
-gem 'json_pure', '<=2.0.1', :require => false if RUBY_VERSION =~ /^1\./
-
-gem 'facter', *location_for(ENV['FACTER_GEM_VERSION'])
-gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])
+gem 'facter', *location_from_env('FACTER_GEM_VERSION')
+gem 'puppet', *location_from_env('PUPPET_GEM_VERSION')
 
 if File.exists? "#{__FILE__}.local"
   eval(File.read("#{__FILE__}.local"), binding)
index 8906d23cd84bcc05501e0b829e45f12035a53aff..3e8d4cb9526d1ac226aa591ea64ac558f905e50a 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -2,13 +2,9 @@ require 'puppet_blacksmith/rake_tasks'
 require 'puppet-lint/tasks/puppet-lint'
 require 'puppetlabs_spec_helper/rake_tasks'
 
-PuppetLint.configuration.fail_on_warnings = true
 PuppetLint.configuration.send('relative')
-PuppetLint.configuration.send('disable_140chars')
-PuppetLint.configuration.send('disable_class_inherits_from_params_class')
 PuppetLint.configuration.send('disable_documentation')
 PuppetLint.configuration.send('disable_single_quote_string_with_variables')
-PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "bundle/**/*", "vendor/**/*"]
 
 desc 'Generate pooler nodesets'
 task :gen_nodeset do
index 1a40c8950f7e88fe7226ee6ddffc9fa73560c67e..5eebdefbfac1d424280fe76b25920a2e639ce77d 100644 (file)
@@ -3,7 +3,7 @@ HOSTS:
     roles:
       - agent
       - default
-    platform: redhat-7-x86_64
+    platform: el-7-x86_64
     hypervisor: vagrant
     box: puppetlabs/centos-7.2-64-nocm
 CONFIG: