diff --git a/.rubocop.yml b/.rubocop.yml index 795fbb61f..feaf4db68 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -44,6 +44,11 @@ Void: Exclude: - 'spec/**/*' +# allow should == nil in spec +Style/NilComparison: + Exclude: + - 'spec/**/*' + # No need to force reduce to use |a, e| as parameters. # Configuration parameters: Methods. Style/SingleLineBlockParams: diff --git a/Guardfile b/Guardfile index 1910f3be7..a915ec3ee 100644 --- a/Guardfile +++ b/Guardfile @@ -1,5 +1,5 @@ -group :red_green_refactor, halt_on_fail:true do - guard :rspec, cmd: 'bundle exec rspec' do +group :red_green_refactor, halt_on_fail: true do + guard :rspec, cmd: 'bundle exec rspec', notification: false do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } @@ -26,7 +26,7 @@ group :red_green_refactor, halt_on_fail:true do # Martin does not want rubocop unless Socket.gethostname == 'martin' - guard :rubocop, cli: '--display-cop-names -c .rubocop-guard.yml' do + guard :rubocop, cli: '--display-cop-names -c .rubocop-guard.yml', notification: false do watch(%r{.+\.rb$}) watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) } watch(%r{(?:.+/)?\.rubocop-guard\.yml$}) { |m| File.dirname(m[0]) } diff --git a/app/models/epp_session.rb b/app/models/epp_session.rb index 325440e0d..816155f21 100644 --- a/app/models/epp_session.rb +++ b/app/models/epp_session.rb @@ -1,9 +1,13 @@ class EppSession < ActiveRecord::Base before_save :marshal_data! + # rubocop: disable Rails/ReadWriteAttribute + # Turned back to read_attribute, thus in Rails 4 + # there is differences between self[:data] and read_attribute. def data - @data ||= self.class.unmarshal(self[:data]) || {} + @data ||= self.class.unmarshal(read_attribute(:data)) || {} end + # rubocop: enable Rails/ReadWriteAttribute def [](key) data[key.to_sym] diff --git a/bin/robot-audit b/bin/robot-audit index 70246edd4..ccf318ba4 100755 --- a/bin/robot-audit +++ b/bin/robot-audit @@ -22,7 +22,7 @@ git log origin/master -n 10 --pretty=oneline | sed -r '/^.{40} Merge branch/d' | echo "END_OF_GIT_LAST_COMMITS" echo "RUBOCOP_RESULTS" -bundle exec rubocop +bundle exec rubocop -D RCODE=$? echo "END_OF_RUBOCOP_RESULTS"