Commit 19caf204 by Cuong Tran Committed by cuong.tran

Fix rubocop problems due to version change

- Replace SpaceAroundKeyword with SpaceAfterControlKeyword - Use an explicit rubocop version to avoid breakages during PRs
parent a29aa470
...@@ -542,7 +542,7 @@ Style/SpaceAfterComma: ...@@ -542,7 +542,7 @@ Style/SpaceAfterComma:
# Offense count: 16 # Offense count: 16
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/SpaceAfterControlKeyword: Style/SpaceAroundKeyword:
Exclude: Exclude:
- 'spec/integration/common_validation.rb' - 'spec/integration/common_validation.rb'
- 'spec/integration/integration_spec.rb' - 'spec/integration/integration_spec.rb'
......
...@@ -16,7 +16,7 @@ group :development, :test do ...@@ -16,7 +16,7 @@ group :development, :test do
gem 'guard-rspec', require: false gem 'guard-rspec', require: false
gem 'terminal-notifier-guard', require: false gem 'terminal-notifier-guard', require: false
gem 'simplecov', require: false gem 'simplecov', require: false
gem 'rubocop', require: false unless RUBY_VERSION =~ /^1.8/ gem 'rubocop', '~> 0.37.2', require: false unless RUBY_VERSION =~ /^1.8/
gem 'coveralls' gem 'coveralls'
gem 'codeclimate-test-reporter' gem 'codeclimate-test-reporter'
......
...@@ -133,8 +133,8 @@ namespace :integration do ...@@ -133,8 +133,8 @@ namespace :integration do
integration_dir = File.expand_path(File.join(File.dirname(__FILE__), 'spec', 'integration')) integration_dir = File.expand_path(File.join(File.dirname(__FILE__), 'spec', 'integration'))
# fixture_dir = File.expand_path(File.join(File.dirname(__FILE__), 'spec', 'fixtures')) # fixture_dir = File.expand_path(File.join(File.dirname(__FILE__), 'spec', 'fixtures'))
target_dir = File.expand_path(ENV['TARGET']) if ENV['TARGET'] target_dir = File.expand_path(ENV['TARGET']) if ENV['TARGET']
fail 'Must specify TARGET=x, where x is an integration test scenario!' unless target_dir && Dir.exist?(target_dir) raise 'Must specify TARGET=x, where x is an integration test scenario!' unless target_dir && Dir.exist?(target_dir)
fail 'TARGET directory must be within spec/integration/!' unless target_dir.start_with?(integration_dir) raise 'TARGET directory must be within spec/integration/!' unless target_dir.start_with?(integration_dir)
candidates = {} candidates = {}
FileList[ FileList[
"#{target_dir}/.rvmrc", "#{target_dir}/.rvmrc",
......
...@@ -248,7 +248,7 @@ module AnnotateModels ...@@ -248,7 +248,7 @@ module AnnotateModels
if indices = indices.select { |ind| ind.columns.include? col.name } if indices = indices.select { |ind| ind.columns.include? col.name }
indices.sort_by(&:name).each do |ind| indices.sort_by(&:name).each do |ind|
ind = ind.columns.reject! { |i| i == col.name } ind = ind.columns.reject! { |i| i == col.name }
attrs << (ind.length == 0 ? "indexed" : "indexed => [#{ind.join(", ")}]") attrs << (ind.empty? ? "indexed" : "indexed => [#{ind.join(", ")}]")
end end
end end
end end
......
...@@ -143,13 +143,15 @@ module AnnotateRoutes ...@@ -143,13 +143,15 @@ module AnnotateRoutes
end end
def self.where_header_found(real_content, header_found_at) def self.where_header_found(real_content, header_found_at)
# By default assume the annotation was found in the middle of the file... # By default assume the annotation was found in the middle of the file
if header_found_at == 1 # ... unless we have evidence it was at the beginning ...
return real_content, :before # ... unless we have evidence it was at the beginning ...
elsif header_found_at >= real_content.count # ... or that it was at the end. return real_content, :before if header_found_at == 1
return real_content, :after
end # ... or that it was at the end.
return real_content, :after if header_found_at >= real_content.count
# and the default
return real_content, header_found_at return real_content, header_found_at
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment