Merge pull request #190 from puppetlabs/modulesync

Update modulesync_config [a3fe424]
This commit is contained in:
Eric Putnam
2016-08-26 13:55:43 -07:00
committed by GitHub
5 changed files with 546 additions and 32 deletions

508
.rubocop.yml Normal file
View File

@@ -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

View 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
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
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"

55
Gemfile
View File

@@ -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
[place, version, { :require => false}].compact
[location, { :require => false }]
end
else
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)

View File

@@ -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

View 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: