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

View File

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

View File

@ -21,10 +21,10 @@ 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
gem 'pry' gem 'pry'
gem 'pry-debugger' gem 'pry-debugger'
gem 'rubocop'
end end

View File

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