Skip to content

Commit

Permalink
Merge pull request #273 from richardc/MCO-519-rubocop
Browse files Browse the repository at this point in the history
MCO-519 rake rubocop should indicate success via exitcode
  • Loading branch information
ploubser committed Jan 7, 2015
2 parents 518474b + 4b98f75 commit c498f0f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
20 changes: 19 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AllCops:
- 'ext/packaging/**/*'
- 'spec/**/*'
- 'tasks/**/*'
- 'lib/mcollective/vendor/**/*'

Lint/ConditionPosition:
Enabled: true
Expand Down Expand Up @@ -42,6 +43,8 @@ Lint/ShadowingOuterLocalVariable:
Lint/LiteralInInterpolation:
Enabled: true

Style/EmptyElse:
Enabled: false

# DISABLED really useless. Detects return as last statement.
Style/RedundantReturn:
Expand All @@ -57,6 +60,9 @@ Lint/AmbiguousOperator:
Lint/AssignmentInCondition:
Enabled: false

Metrics/AbcSize:
Enabled: false

Metrics/BlockNesting:
Enabled: false

Expand Down Expand Up @@ -333,7 +339,16 @@ Style/EmptyLines:
Style/EmptyLinesAroundAccessModifier:
Enabled: false

Style/EmptyLinesAroundBody:
Style/EmptyLinesAroundBlockBody:
Enabled: false

Style/EmptyLinesAroundMethodBody:
Enabled: false

Style/EmptyLinesAroundClassBody:
Enabled: false

Style/EmptyLinesAroundModuleBody:
Enabled: false

Style/EmptyLiteral:
Expand All @@ -354,6 +369,9 @@ Style/TrailingWhitespace:
Style/StringLiterals:
Enabled: false

Style/StringLiteralsInInterpolation:
Enabled: false

Style/TrailingComma:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gem 'systemu'

group :dev do
gem 'rake'
gem "rubocop", :platforms => [:ruby] unless RUBY_VERSION =~ /^1.8/
gem 'rubocop', '~> 0.28.0', :platforms => [:ruby] unless RUBY_VERSION =~ /^1.8/
end

group :test do
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ task(:rubocop) do
if RUBY_VERSION !~ /1.8/
require 'rubocop'
cli = RuboCop::CLI.new
cli.run(%w(-D -f s))
exit cli.run(%w(-D -f s))
else
puts "Rubocop is disabled in ruby 1.8"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mcollective/matcher/scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def gen_statement
else
if func
if current_token_value.match(/^.+?\((\s*(')[^']*(')\s*(,\s*(')[^']*('))*)?\)(\.[a-zA-Z0-9_]+)?((!=|<=|>=|=|>|<).+)?$/) ||
current_token_value.match(/^.+?\((\s*(")[^"]*(")\s*(,\s*(")[^"]*("))*)?\)(\.[a-zA-Z0-9_]+)?((!=|<=|>=|=|>|<).+)?$/)
current_token_value.match(/^.+?\((\s*(")[^"]*(")\s*(,\s*(")[^"]*("))*)?\)(\.[a-zA-Z0-9_]+)?((!=|<=|>=|=|>|<).+)?$/)
return "fstatement", current_token_value
else
return "bad_token", [@token_index - current_token_value.size + 1, @token_index]
Expand Down
3 changes: 1 addition & 2 deletions plugins/mcollective/application/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ def set_plugin_type
# Return the name of the type of plugin as a string
def identify_plugin
plugintype = Dir.glob(File.join(configuration[:target], "*")).select do |file|
File.directory?(file) &&
file.match(/(connector|facts|registration|security|audit|pluginpackager|data|discovery|validator)/)
File.directory?(file) && file.match(/(connector|facts|registration|security|audit|pluginpackager|data|discovery|validator)/)
end

raise RuntimeError, "more than one plugin type detected in directory" if plugintype.size > 1
Expand Down

0 comments on commit c498f0f

Please sign in to comment.