summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Leitzen <pleitzen@gitlab.com>2019-08-30 12:33:29 +0200
committerPeter Leitzen <pleitzen@gitlab.com>2019-09-02 18:13:39 +0200
commit451a6634e4444139ba13028bd64573a3097047e2 (patch)
tree9be24a43962e49691adf43035769d81d10a9ead6
parent1d3d12764897eb303fedeeb82d1b444c526ccb07 (diff)
downloadgitlab-ce-pl-project-service-filename-lineo.tar.gz
Provide filename and line number for `class_eval`pl-project-service-filename-lineo
This commit removes one RuboCop offense from its todo file.
-rw-r--r--.rubocop_todo.yml5
-rw-r--r--app/models/service.rb8
2 files changed, 4 insertions, 9 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 3898206e3b5..be147d72f71 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -570,11 +570,6 @@ Style/EmptyMethod:
Style/Encoding:
Enabled: false
-# Offense count: 2
-Style/EvalWithLocation:
- Exclude:
- - 'app/models/service.rb'
-
# Offense count: 203
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
diff --git a/app/models/service.rb b/app/models/service.rb
index f6d8fb1fb46..431c5881460 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -174,7 +174,7 @@ class Service < ApplicationRecord
# Also keep track of updated properties in a similar way as ActiveModel::Dirty
def self.prop_accessor(*args)
args.each do |arg|
- class_eval %{
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
unless method_defined?(arg)
def #{arg}
properties['#{arg}']
@@ -198,7 +198,7 @@ class Service < ApplicationRecord
def #{arg}_was
updated_properties['#{arg}']
end
- }
+ RUBY
end
end
@@ -209,12 +209,12 @@ class Service < ApplicationRecord
self.prop_accessor(*args)
args.each do |arg|
- class_eval %{
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
def #{arg}?
# '!!' is used because nil or empty string is converted to nil
!!ActiveRecord::Type::Boolean.new.cast(#{arg})
end
- }
+ RUBY
end
end