diff --git a/.codeclimate.yml b/.codeclimate.yml index 70f86d6..1d7ac22 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -6,6 +6,7 @@ engines: enabled: false rubocop: enabled: true + channel: rubocop-0-67 reek: enabled: true checks: diff --git a/.ruby-version b/.ruby-version index 73462a5..ec1cf33 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.1 +2.6.3 diff --git a/.travis.yml b/.travis.yml index dc37ee0..729cc50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,5 @@ rvm: - "2.3.7" - "2.4.4" - "2.5.1" + - "2.6.3" script: bundle exec rspec diff --git a/Gemfile.lock b/Gemfile.lock index bd15933..bf578ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,7 +56,7 @@ GEM i18n (1.1.1) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - jaro_winkler (1.5.1) + jaro_winkler (1.5.2) loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) @@ -65,13 +65,13 @@ GEM minitest (5.11.3) nokogiri (1.8.5) mini_portile2 (~> 2.3.0) - parallel (1.12.1) - parser (2.5.1.2) + parallel (1.17.0) + parser (2.6.3.0) ast (~> 2.4.0) - powerpack (0.1.2) pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) + psych (3.1.0) rack (2.0.5) rack-test (1.1.0) rack (>= 1.0, < 3) @@ -97,20 +97,22 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) rspec-support (3.8.0) - rubocop (0.59.2) + rubocop (0.67.2) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) - powerpack (~> 0.1) + psych (>= 3.1.0) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) + unicode-display_width (>= 1.4.0, < 1.6) + rubocop-performance (1.1.0) + rubocop (>= 0.67.0) ruby-progressbar (1.10.0) sqlite3 (1.3.13) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - unicode-display_width (1.4.0) + unicode-display_width (1.5.0) virtus (1.0.5) axiom-types (~> 0.1) coercible (~> 1.0) @@ -130,9 +132,10 @@ DEPENDENCIES rectify! rspec (~> 3.8) rspec-collection_matchers (~> 1.1) - rubocop + rubocop (~> 0.67.2) + rubocop-performance sqlite3 wisper-rspec BUNDLED WITH - 1.16.2 + 1.17.2 diff --git a/lib/rectify/command.rb b/lib/rectify/command.rb index 684af72..31649e5 100644 --- a/lib/rectify/command.rb +++ b/lib/rectify/command.rb @@ -6,12 +6,10 @@ def initialize @events = {} end - # rubocop:disable Style/MethodMissing def method_missing(method_name, *args, &_block) args = args.first if args.size == 1 @events[method_name] = args end - # rubocop:enable Style/MethodMissing def respond_to_missing?(_method_name, _include_private = false) true diff --git a/lib/rectify/rspec/database_reporter/reporter.rb b/lib/rectify/rspec/database_reporter/reporter.rb index ccd4d8b..8e49926 100644 --- a/lib/rectify/rspec/database_reporter/reporter.rb +++ b/lib/rectify/rspec/database_reporter/reporter.rb @@ -17,7 +17,7 @@ class DatabaseReporter ^SAVEPOINT| ^SHOW| ^PRAGMA - /xi + /xi.freeze def self.enable ::RSpec.configure do |config| diff --git a/rectify.gemspec b/rectify.gemspec index 758c8c4..16b907b 100644 --- a/rectify.gemspec +++ b/rectify.gemspec @@ -24,6 +24,7 @@ Gem::Specification.new do |s| s.add_development_dependency "rake" s.add_development_dependency "rspec", "~> 3.8" s.add_development_dependency "rspec-collection_matchers", "~> 1.1" - s.add_development_dependency "rubocop" + s.add_development_dependency "rubocop", "~> 0.67.2" + s.add_development_dependency "rubocop-performance" s.add_development_dependency "sqlite3" end diff --git a/spec/lib/rectify/command_spec.rb b/spec/lib/rectify/command_spec.rb index 0f428da..208362a 100644 --- a/spec/lib/rectify/command_spec.rb +++ b/spec/lib/rectify/command_spec.rb @@ -26,9 +26,9 @@ events = ReturnMultiEventMultiResultCommand.call expect(events).to eq( - :ok => [1, 2, 3], + :ok => [1, 2, 3], :published => "The command works", - :next => [] + :next => [] ) end end @@ -56,7 +56,7 @@ def something_private @private = true end - private :something_private + private :something_private # rubocop:disable Style/AccessModifierDeclarations it "calls public methods on the caller" do @success = false diff --git a/spec/lib/rectify/form_spec.rb b/spec/lib/rectify/form_spec.rb index 0452bec..e16d6c4 100644 --- a/spec/lib/rectify/form_spec.rb +++ b/spec/lib/rectify/form_spec.rb @@ -8,7 +8,7 @@ ) expect(form).to have_attributes( - :user => "andy38", + :user => "andy38", :first_name => "Andy", :age => 38 ) @@ -18,7 +18,7 @@ form = UserForm.new(:user => "andy38", :first_name => "Andy", :age => 38) expect(form).to have_attributes( - :user => "andy38", + :user => "andy38", :first_name => "Andy", :age => 38 ) @@ -28,18 +28,18 @@ describe ".from_params" do let(:params) do ActionController::Parameters.new( - "id" => "1", + "id" => "1", "other_id" => "2", "user" => { - "user" => "andy38", + "user" => "andy38", "first_name" => "Andy", - "age" => "38", - "colours" => %w[red blue green], - "file" => ActionDispatch::Http::UploadedFile.new(:tempfile => Tempfile.new("file")), + "age" => "38", + "colours" => %w[red blue green], + "file" => ActionDispatch::Http::UploadedFile.new(:tempfile => Tempfile.new("file")), "address" => { - "street" => "1 High Street", - "town" => "Wimbledon", - "city" => "London", + "street" => "1 High Street", + "town" => "Wimbledon", + "city" => "London", "post_code" => "SW19 1AB" }, "contacts" => [ @@ -55,10 +55,10 @@ form = UserForm.from_params(params) expect(form).to have_attributes( - :user => "andy38", + :user => "andy38", :first_name => "Andy", - :age => 38, - :colours => %w[red blue green] + :age => 38, + :colours => %w[red blue green] ) end @@ -78,9 +78,9 @@ form = UserForm.from_params(params) expect(form.address).to have_attributes( - :street => "1 High Street", - :town => "Wimbledon", - :city => "London", + :street => "1 High Street", + :town => "Wimbledon", + :city => "London", :post_code => "SW19 1AB" ) end @@ -169,10 +169,10 @@ form = ChildForm.from_params(params) expect(form).to have_attributes( - :user => "andy38", + :user => "andy38", :first_name => "Andy", - :age => 38, - :school => "Rutlish" + :age => 38, + :school => "Rutlish" ) end @@ -200,16 +200,16 @@ describe ".from_model" do let(:model) do User.new( - :user => "andy38", + :user => "andy38", :first_name => "Andy", - :age => 38, - :contacts => [ + :age => 38, + :contacts => [ Contact.new(:name => "James", :number => "12345") ], :address => Address.new( - :street => "1 High Street", - :town => "Wimbledon", - :city => "London", + :street => "1 High Street", + :town => "Wimbledon", + :city => "London", :post_code => "SW19 1AB" ), :last_logged_in => Time.new(2016, 1, 30, 9, 30, 0) @@ -220,7 +220,7 @@ form = UserForm.from_model(model) expect(form).to have_attributes( - :user => "andy38", + :user => "andy38", :first_name => "Andy", :age => 38 ) @@ -231,7 +231,7 @@ expect(form.contacts).to have(1).item expect(form.contacts.first).to have_attributes( - :name => "James", + :name => "James", :number => "12345" ) end @@ -240,9 +240,9 @@ form = UserForm.from_model(model) expect(form.address).to have_attributes( - :street => "1 High Street", - :town => "Wimbledon", - :city => "London", + :street => "1 High Street", + :town => "Wimbledon", + :city => "London", :post_code => "SW19 1AB" ) end @@ -273,7 +273,7 @@ form = UserForm.from_json(json) expect(form).to have_attributes( - :user => "andy38", + :user => "andy38", :first_name => "Andy", :age => 38 ) @@ -357,14 +357,14 @@ describe "#attributes_with_values" do it "returns a hash of attributes where their values are non-nil" do form = AddressForm.new( - :id => 1, - :street => "1 High Street", - :town => nil, + :id => 1, + :street => "1 High Street", + :town => nil, :post_code => "GU1 2AB" ) expect(form.attributes_with_values).to eq( - :street => "1 High Street", + :street => "1 High Street", :post_code => "GU1 2AB" ) end @@ -483,7 +483,7 @@ it "returns true" do form = UserForm.new( :first_name => "Andy", - :contacts => [ContactForm.new(:name => "Andy")] + :contacts => [ContactForm.new(:name => "Andy")] ) expect(form).to be_valid @@ -549,7 +549,7 @@ it "assigns a context to array attribute child forms" do form = UserForm.new( :first_name => "Andy", - :contacts => [ContactForm.new(:name => "Andy")] + :contacts => [ContactForm.new(:name => "Andy")] ).with_context(:account_id => 1) expect(form.contacts.first.context.account_id).to eq(1)