(PDOC-8) Add rubocop to travis job

In order to ensure long term code quality, add a rubocop check to
the travis job which runs when a pull request is submitted. Do this
by adding a rake task for rubocop and setting up travis to run
both the spec rake task and the rubocop one.

Additionally, make a few changes to the .rubocop.yml file so it
will stop complaining about incorrect namespaces.
This commit is contained in:
Hailee Kenney 2014-10-08 13:35:14 -07:00
parent 999daa9c4c
commit 1abca4705f
4 changed files with 19 additions and 13 deletions

View File

@ -65,7 +65,7 @@ Style/RedundantSelf:
Enabled: false
# DISABLED - not useful
Style/MethodLength:
Metrics/MethodLength:
Enabled: false
# DISABLED - not useful
@ -143,7 +143,7 @@ Style/AlignHash:
Style/AlignParameters:
Enabled: false
Style/BlockNesting:
Metrics/BlockNesting:
Enabled: false
Style/AsciiComments:
@ -176,7 +176,7 @@ Style/ClassAndModuleChildren:
Style/ClassCheck:
Enabled: false
Style/ClassLength:
Metrics/ClassLength:
Enabled: false
Style/ClassMethods:
@ -264,7 +264,7 @@ Style/ColonMethodCall:
Style/CommentAnnotation:
Enabled: false
Style/CyclomaticComplexity:
Metrics/CyclomaticComplexity:
Enabled: false
Style/ConstantName:
@ -316,7 +316,7 @@ Style/EmptyLinesAroundBody:
Style/EmptyLiteral:
Enabled: false
Style/LineLength:
Metrics/LineLength:
Enabled: false
Style/MethodCallParentheses:
@ -472,7 +472,7 @@ Style/RegexpLiteral:
Lint/UnderscorePrefixedVariableName:
Enabled: false
Style/ParameterLists:
Metrics/ParameterLists:
Enabled: false
Lint/RequireParentheses:

View File

@ -1,17 +1,17 @@
language: ruby
bundler_args: --without development
script: "bundle exec rake spec SPEC_OPTS='--color --format documentation'"
script:
- "bundle exec rake $CHECK"
notifications:
email: false
rvm:
- 1.9.3
- 2.0.0
- 2.1.0
- ruby-head
env:
- PUPPET_VERSION=3.6.2
- PUPPET_VERSION=3.7.1
- "CHECK=spec SPEC_OPTS='--color --format documentation'"
- "CHECK=rubocop"
matrix:
fast_finish: true
allow_failures:
- rvm: ruby-head

View File

@ -21,10 +21,10 @@ group :test do
gem 'serverspec'
gem 'beaker'
gem 'beaker-rspec'
gem 'rubocop'
end
group :development do
gem 'pry'
gem 'pry-debugger'
gem 'rubocop'
end

View File

@ -22,3 +22,9 @@ task :acceptance do
sh "puppet module build spec/unit/puppet/examples/test"
sh "BEAKER_set=#{ENV["platform"]} rspec spec/acceptance/*.rb"
end
task(:rubocop) do
require 'rubocop'
cli = RuboCop::CLI.new
cli.run(%w(-D -f s))
end