Skip to content

Commit b319409

Browse files
committed
Merge pull request #344 from ctran/fix/rubocop-deprecation
Fix rubocop problems due to version change
2 parents a29aa47 + 19caf20 commit b319409

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ Style/SpaceAfterComma:
542542

543543
# Offense count: 16
544544
# Cop supports --auto-correct.
545-
Style/SpaceAfterControlKeyword:
545+
Style/SpaceAroundKeyword:
546546
Exclude:
547547
- 'spec/integration/common_validation.rb'
548548
- 'spec/integration/integration_spec.rb'

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ group :development, :test do
1616
gem 'guard-rspec', require: false
1717
gem 'terminal-notifier-guard', require: false
1818
gem 'simplecov', require: false
19-
gem 'rubocop', require: false unless RUBY_VERSION =~ /^1.8/
19+
gem 'rubocop', '~> 0.37.2', require: false unless RUBY_VERSION =~ /^1.8/
2020
gem 'coveralls'
2121
gem 'codeclimate-test-reporter'
2222

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ namespace :integration do
133133
integration_dir = File.expand_path(File.join(File.dirname(__FILE__), 'spec', 'integration'))
134134
# fixture_dir = File.expand_path(File.join(File.dirname(__FILE__), 'spec', 'fixtures'))
135135
target_dir = File.expand_path(ENV['TARGET']) if ENV['TARGET']
136-
fail 'Must specify TARGET=x, where x is an integration test scenario!' unless target_dir && Dir.exist?(target_dir)
137-
fail 'TARGET directory must be within spec/integration/!' unless target_dir.start_with?(integration_dir)
136+
raise 'Must specify TARGET=x, where x is an integration test scenario!' unless target_dir && Dir.exist?(target_dir)
137+
raise 'TARGET directory must be within spec/integration/!' unless target_dir.start_with?(integration_dir)
138138
candidates = {}
139139
FileList[
140140
"#{target_dir}/.rvmrc",

lib/annotate/annotate_models.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def get_schema_info(klass, header, options = {})
248248
if indices = indices.select { |ind| ind.columns.include? col.name }
249249
indices.sort_by(&:name).each do |ind|
250250
ind = ind.columns.reject! { |i| i == col.name }
251-
attrs << (ind.length == 0 ? "indexed" : "indexed => [#{ind.join(", ")}]")
251+
attrs << (ind.empty? ? "indexed" : "indexed => [#{ind.join(", ")}]")
252252
end
253253
end
254254
end

lib/annotate/annotate_routes.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,15 @@ def self.strip_annotations(content)
143143
end
144144

145145
def self.where_header_found(real_content, header_found_at)
146-
# By default assume the annotation was found in the middle of the file...
147-
if header_found_at == 1 # ... unless we have evidence it was at the beginning ...
148-
return real_content, :before
149-
elsif header_found_at >= real_content.count # ... or that it was at the end.
150-
return real_content, :after
151-
end
146+
# By default assume the annotation was found in the middle of the file
147+
148+
# ... unless we have evidence it was at the beginning ...
149+
return real_content, :before if header_found_at == 1
150+
151+
# ... or that it was at the end.
152+
return real_content, :after if header_found_at >= real_content.count
152153

154+
# and the default
153155
return real_content, header_found_at
154156
end
155157

0 commit comments

Comments
 (0)