Merge remote-tracking branch 'upstream/pr/18'
* upstream/pr/18: (PDOC-8) Add rubocop to travis job (PDOC-8) Fix present rubocop offenses (PDOC-8) Add .rubocop.yml to project
This commit is contained in:
commit
adae47b90f
|
@ -0,0 +1,494 @@
|
||||||
|
AllCops:
|
||||||
|
Exclude:
|
||||||
|
# Ignore HTML related things
|
||||||
|
- '**/*.erb'
|
||||||
|
- 'lib/puppetx/puppetlabs/strings/yard/templates/**/*'
|
||||||
|
|
||||||
|
Lint/ConditionPosition:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Lint/ElseLayout:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Lint/UnreachableCode:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Lint/UselessComparison:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# MAYBE useful - no return inside ensure block.
|
||||||
|
Lint/EnsureReturn:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# MAYBE useful - errors when rescue {} happens.
|
||||||
|
Lint/HandleExceptions:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# MAYBE useful - catches while 1
|
||||||
|
Lint/LiteralInCondition:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# MAYBE useful - but too many instances
|
||||||
|
Lint/ShadowingOuterLocalVariable:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Can catch complicated strings.
|
||||||
|
Lint/LiteralInInterpolation:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# DISABLED really useless. Detects return as last statement.
|
||||||
|
Style/RedundantReturn:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED since the instances do not seem to indicate any specific errors.
|
||||||
|
Lint/AmbiguousOperator:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/AssignmentInCondition:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# DISABLED - not useful
|
||||||
|
Style/SpaceBeforeComment:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED - not useful
|
||||||
|
Style/HashSyntax:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# USES: as shortcut for non nil&valid checking a = x() and a.empty?
|
||||||
|
# DISABLED - not useful
|
||||||
|
Style/AndOr:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED - not useful
|
||||||
|
Style/RedundantSelf:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED - not useful
|
||||||
|
Metrics/MethodLength:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED - not useful
|
||||||
|
Style/WhileUntilModifier:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED - the offender is just haskell envy
|
||||||
|
Lint/AmbiguousRegexpLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED
|
||||||
|
Lint/Eval:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED
|
||||||
|
Lint/BlockAlignment:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED
|
||||||
|
Lint/DefEndAlignment:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED
|
||||||
|
Lint/EndAlignment:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED
|
||||||
|
Lint/DeprecatedClassMethods:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED
|
||||||
|
Lint/Loop:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED
|
||||||
|
Lint/ParenthesesAsGroupedExpression:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/RescueException:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/StringConversionInInterpolation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/UnusedBlockArgument:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/UnusedMethodArgument:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/UselessAccessModifier:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Lint/UselessAssignment:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Lint/Void:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Style/AccessModifierIndentation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/AccessorMethodName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Alias:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/AlignArray:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/AlignHash:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/AlignParameters:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Metrics/BlockNesting:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/AsciiComments:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Attr:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Blocks:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/BracesAroundHashParameters:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/CaseEquality:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/CaseIndentation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/CharacterLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ClassAndModuleCamelCase:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ClassAndModuleChildren:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ClassCheck:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Metrics/ClassLength:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ClassMethods:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ClassVars:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/WhenThen:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED - not useful
|
||||||
|
Style/WordArray:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/UnneededPercentQ:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Tab:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceBeforeSemicolon:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/TrailingBlankLines:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceInsideBlockBraces:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceInsideBrackets:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceInsideHashLiteralBraces:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceInsideParens:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/LeadingCommentSpace:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SingleSpaceBeforeFirstArg:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceAfterColon:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceAfterComma:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceAfterControlKeyword:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceAfterMethodName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceAfterNot:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceAfterSemicolon:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceAroundEqualsInParameterDefault:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceAroundOperators:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceBeforeBlockBraces:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpaceBeforeComma:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/CollectionMethods:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/CommentIndentation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ColonMethodCall:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/CommentAnnotation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Metrics/CyclomaticComplexity:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ConstantName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Documentation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/DefWithParentheses:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/DeprecatedHashMethods:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/DotPosition:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# DISABLED - used for converting to bool
|
||||||
|
Style/DoubleNegation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/EachWithObject:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/EmptyLineBetweenDefs:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/IndentArray:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/IndentHash:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/IndentationConsistency:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/IndentationWidth:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/EmptyLines:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/EmptyLinesAroundAccessModifier:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/EmptyLinesAroundBody:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/EmptyLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Metrics/LineLength:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/MethodCallParentheses:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/MethodDefParentheses:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/LineEndConcatenation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/TrailingWhitespace:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/StringLiterals:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/TrailingComma:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/GlobalVars:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/GuardClause:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/IfUnlessModifier:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/MultilineIfThen:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/NegatedIf:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/NegatedWhile:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Next:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SingleLineBlockParams:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SingleLineMethods:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SpecialGlobalVars:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/TrivialAccessors:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/UnlessElse:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/UnneededPercentX:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/VariableInterpolation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/VariableName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/WhileUntilDo:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/EvenOdd:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/FileName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/For:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Lambda:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/MethodName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/MultilineTernaryOperator:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/NestedTernaryOperator:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/NilComparison:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/FormatString:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/MultilineBlockChain:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Semicolon:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SignalException:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/NonNilCheck:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Not:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/NumericLiterals:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/OneLineConditional:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/OpMethod:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ParenthesesAroundCondition:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/PercentLiteralDelimiters:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/PerlBackrefs:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/PredicateName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RedundantException:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SelfAssignment:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Proc:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RaiseArgs:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RedundantBegin:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RescueModifier:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RegexpLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/UnderscorePrefixedVariableName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Metrics/ParameterLists:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/RequireParentheses:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/SpaceBeforeFirstArg:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ModuleFunction:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/Debugger:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/IfWithSemicolon:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Encoding:
|
||||||
|
Enabled: false
|
12
.travis.yml
12
.travis.yml
|
@ -1,17 +1,17 @@
|
||||||
language: ruby
|
language: ruby
|
||||||
bundler_args: --without development
|
bundler_args: --without development
|
||||||
script: "bundle exec rake spec SPEC_OPTS='--color --format documentation'"
|
script:
|
||||||
|
- "bundle exec rake $CHECK"
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
rvm:
|
rvm:
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
- 2.0.0
|
- 2.0.0
|
||||||
- 2.1.0
|
- 2.1.0
|
||||||
- ruby-head
|
|
||||||
env:
|
env:
|
||||||
- PUPPET_VERSION=3.6.2
|
- "CHECK=spec SPEC_OPTS='--color --format documentation'"
|
||||||
- PUPPET_VERSION=3.7.1
|
- "CHECK=rubocop"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
|
||||||
- rvm: ruby-head
|
|
||||||
|
|
5
Gemfile
5
Gemfile
|
@ -5,7 +5,9 @@ gem 'rgen'
|
||||||
gem 'redcarpet'
|
gem 'redcarpet'
|
||||||
gem 'puppet-strings', '0.1.0', :path => '.'
|
gem 'puppet-strings', '0.1.0', :path => '.'
|
||||||
|
|
||||||
if puppetversion = ENV['PUPPET_VERSION']
|
puppetversion = ENV['PUPPET_VERSION']
|
||||||
|
|
||||||
|
if puppetversion
|
||||||
gem 'puppet', puppetversion
|
gem 'puppet', puppetversion
|
||||||
else
|
else
|
||||||
gem 'puppet', '~> 3.6.2'
|
gem 'puppet', '~> 3.6.2'
|
||||||
|
@ -19,6 +21,7 @@ group :test do
|
||||||
gem 'serverspec'
|
gem 'serverspec'
|
||||||
gem 'beaker'
|
gem 'beaker'
|
||||||
gem 'beaker-rspec'
|
gem 'beaker-rspec'
|
||||||
|
gem 'rubocop'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
|
|
6
Rakefile
6
Rakefile
|
@ -22,3 +22,9 @@ task :acceptance do
|
||||||
sh "puppet module build spec/unit/puppet/examples/test"
|
sh "puppet module build spec/unit/puppet/examples/test"
|
||||||
sh "BEAKER_set=#{ENV["platform"]} rspec spec/acceptance/*.rb"
|
sh "BEAKER_set=#{ENV["platform"]} rspec spec/acceptance/*.rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task(:rubocop) do
|
||||||
|
require 'rubocop'
|
||||||
|
cli = RuboCop::CLI.new
|
||||||
|
cli.run(%w(-D -f s))
|
||||||
|
end
|
||||||
|
|
|
@ -38,12 +38,14 @@ Puppet::Face.define(:strings, '0.0.1') do
|
||||||
yardoc_actions = Puppetx::PuppetLabs::Strings::Actions.new(Puppet[:debug], Puppet[:trace])
|
yardoc_actions = Puppetx::PuppetLabs::Strings::Actions.new(Puppet[:debug], Puppet[:trace])
|
||||||
|
|
||||||
# The last element of the argument array should be the options hash.
|
# The last element of the argument array should be the options hash.
|
||||||
|
# We don't have any options yet, so for now just pop the hash off and
|
||||||
|
# toss it.
|
||||||
#
|
#
|
||||||
# NOTE: The Puppet Face will throw 'unrecognized option' errors if any
|
# NOTE: The Puppet Face will throw 'unrecognized option' errors if any
|
||||||
# YARD options are passed to it. The best way to approach this problem is
|
# YARD options are passed to it. The best way to approach this problem is
|
||||||
# by using the `.yardopts` file. YARD will autoload any options placed in
|
# by using the `.yardopts` file. YARD will autoload any options placed in
|
||||||
# that file.
|
# that file.
|
||||||
opts = args.pop
|
args.pop
|
||||||
|
|
||||||
# For now, assume the remaining positional args are a list of manifest
|
# For now, assume the remaining positional args are a list of manifest
|
||||||
# and ruby files to parse.
|
# and ruby files to parse.
|
||||||
|
@ -67,7 +69,7 @@ Puppet::Face.define(:strings, '0.0.1') do
|
||||||
|
|
||||||
server_actions = Puppetx::PuppetLabs::Strings::Actions.new(Puppet[:debug], Puppet[:trace])
|
server_actions = Puppetx::PuppetLabs::Strings::Actions.new(Puppet[:debug], Puppet[:trace])
|
||||||
|
|
||||||
opts = args.pop
|
args.pop
|
||||||
|
|
||||||
module_names = args
|
module_names = args
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ unless ENV['RS_PROVISION'] == 'no'
|
||||||
end
|
end
|
||||||
|
|
||||||
RSpec.configure do |c|
|
RSpec.configure do |c|
|
||||||
# Project root
|
|
||||||
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
|
||||||
|
|
||||||
# Readable test descriptions
|
# Readable test descriptions
|
||||||
c.formatter = :documentation
|
c.formatter = :documentation
|
||||||
|
|
Loading…
Reference in New Issue