Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubocop 1.x Support #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
appraise 'rubocop-0.41' do
gem 'rubocop', '~> 0.41.0'
appraise 'rubocop-1.0' do
gem 'rubocop', '~> 1.0.0'
end

appraise 'rubocop-0.42' do
gem 'rubocop', '~> 0.42.0'
appraise 'rubocop-1.1' do
gem 'rubocop', '~> 1.1.0'
end

appraise 'rubocop-0.43' do
gem 'rubocop', '~> 0.43.0'
appraise 'rubocop-1.2' do
gem 'rubocop', '~> 1.2.0'
end

appraise 'rubocop-1.3' do
gem 'rubocop', '~> 1.2.0'
end

appraise 'latest-rubocop' do
Expand Down
29 changes: 29 additions & 0 deletions bin/appraisal
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'appraisal' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("../bundle", __FILE__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("appraisal", "appraisal")
1 change: 1 addition & 0 deletions gemfiles/.bundle/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_RETRY: "1"
2 changes: 1 addition & 1 deletion gemfiles/latest_rubocop.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source "https://rubygems.org"

gem "rubocop"

gemspec :path => "../"
gemspec path: "../"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rubocop", "~> 0.41.0"
gem "rubocop", "~> 1.0.0"

gemspec :path => "../"
gemspec path: "../"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rubocop", "~> 0.42.0"
gem "rubocop", "~> 1.1.0"

gemspec :path => "../"
gemspec path: "../"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rubocop", "~> 0.43.0"
gem "rubocop", "~> 1.2.0"

gemspec :path => "../"
gemspec path: "../"
7 changes: 7 additions & 0 deletions gemfiles/rubocop_1.3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rubocop", "~> 1.2.0"

gemspec path: "../"
2 changes: 1 addition & 1 deletion lib/rubocop/cop/migrations/remove_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def on_send(node)
node.each_ancestor do |a|
next unless a.def_type?
if a.to_s =~ /def :up/ || a.to_s =~ /def :change/
add_offense(node, :selector, MSG)
add_offense(node, location: :selector, message: MSG)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions rubocop-migrations.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_runtime_dependency 'rubocop', '~> 0.41'
spec.add_runtime_dependency 'rubocop', '~> 1.0'

spec.add_development_dependency 'bundler', '~> 1.11'
spec.add_development_dependency 'bundler', '~> 2.1.4'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.5'
spec.add_development_dependency 'appraisal'
spec.add_development_dependency 'appraisal', '~> 2.3.0'
end
4 changes: 2 additions & 2 deletions spec/support/shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ module SharedExamples
end

def expect_no_offenses(cop, source)
inspect_source(cop, source)
inspect_source(source)
expect(cop.offenses).to be_empty
end

def expect_reported_offenses(cop, source, expected_offenses)
inspect_source(cop, source)
inspect_source(source)
expect(cop.offenses.size).to eq(expected_offenses.size)
expected_offenses.zip(cop.offenses).each do |expected, actual|
expect_offense(expected, actual)
Expand Down