Merge pull request #4735 from betagouv/fix/rubocop-custom-rule
Only load rubocop's custom rule in development
This commit is contained in:
commit
a6b337c436
1 changed files with 13 additions and 11 deletions
|
@ -1,16 +1,18 @@
|
|||
module RuboCop
|
||||
module Cop
|
||||
module DS
|
||||
class Unscoped < Cop
|
||||
MSG = "Avoid using `unscoped`. Instead unscope specific clauses by using `unscope(where: :attribute)`."
|
||||
if ENV["RAILS_ENV"] == "development"
|
||||
module RuboCop
|
||||
module Cop
|
||||
module DS
|
||||
class Unscoped < Cop
|
||||
MSG = "Avoid using `unscoped`. Instead unscope specific clauses by using `unscope(where: :attribute)`."
|
||||
|
||||
def_node_matcher :unscoped?, <<-END
|
||||
(send _ :unscoped)
|
||||
END
|
||||
def_node_matcher :unscoped?, <<-END
|
||||
(send _ :unscoped)
|
||||
END
|
||||
|
||||
def on_send(node)
|
||||
return unless unscoped?(node)
|
||||
add_offense(node)
|
||||
def on_send(node)
|
||||
return unless unscoped?(node)
|
||||
add_offense(node)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue