Commit 3783c234 authored by Luke Duncalfe's avatar Luke Duncalfe

Link to issue in CodeReuse/ActiveRecord message

This provides the user with some context as to why certain ActiveRecord
methods are blacklisted.
parent e6d87e22
...@@ -9,7 +9,8 @@ module RuboCop ...@@ -9,7 +9,8 @@ module RuboCop
class ActiveRecord < RuboCop::Cop::Cop class ActiveRecord < RuboCop::Cop::Cop
include CodeReuseHelpers include CodeReuseHelpers
MSG = 'This method can only be used inside an ActiveRecord model' MSG = 'This method can only be used inside an ActiveRecord model: ' \
'https://gitlab.com/gitlab-org/gitlab-ce/issues/49653'
# Various methods from ActiveRecord::Querying that are blacklisted. We # Various methods from ActiveRecord::Querying that are blacklisted. We
# exclude some generic ones such as `any?` and `first`, as these may # exclude some generic ones such as `any?` and `first`, as these may
......
...@@ -14,7 +14,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do ...@@ -14,7 +14,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do
expect_offense(<<~SOURCE) expect_offense(<<~SOURCE)
def foo def foo
User.where User.where
^^^^^ This method can only be used inside an ActiveRecord model ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-ce/issues/49653
end end
SOURCE SOURCE
end end
...@@ -23,7 +23,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do ...@@ -23,7 +23,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do
expect_offense(<<~SOURCE) expect_offense(<<~SOURCE)
def foo def foo
User.where(id: 10) User.where(id: 10)
^^^^^ This method can only be used inside an ActiveRecord model ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-ce/issues/49653
end end
SOURCE SOURCE
end end
...@@ -40,7 +40,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do ...@@ -40,7 +40,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do
expect_offense(<<~SOURCE) expect_offense(<<~SOURCE)
def foo def foo
project.group(:name) project.group(:name)
^^^^^ This method can only be used inside an ActiveRecord model ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-ce/issues/49653
end end
SOURCE SOURCE
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment