未验证 提交 09ec075f 编写于 作者: B bogdanvlviv

Remove Rubocop's comments from Rails code base

PR#32381 added Rubocop's comments to some tests files in order to
exclude `Performance/RedundantMerge`.

Turn off `Performance` cops for tests files via `Exclude`
in `.rubocop.yml`.

Context https://github.com/rails/rails/pull/32381#discussion_r205212331
上级 f0c917c7
......@@ -9,6 +9,10 @@ AllCops:
- 'actionpack/lib/action_dispatch/journey/parser.rb'
- 'railties/test/fixtures/tmp/**/*'
Performance:
Exclude:
- '**/test/**/*'
Rails:
Enabled: true
......
......@@ -105,20 +105,16 @@ def make_headers(hash)
end
test "#merge! headers with mutation" do
# rubocop:disable Performance/RedundantMerge
@headers.merge!("Host" => "http://example.test",
"Content-Type" => "text/html")
# rubocop:enable Performance/RedundantMerge
assert_equal({ "HTTP_HOST" => "http://example.test",
"CONTENT_TYPE" => "text/html",
"HTTP_REFERER" => "/some/page" }, @headers.env)
end
test "#merge! env with mutation" do
# rubocop:disable Performance/RedundantMerge
@headers.merge!("HTTP_HOST" => "http://first.com",
"CONTENT_TYPE" => "text/html")
# rubocop:enable Performance/RedundantMerge
assert_equal({ "HTTP_HOST" => "http://first.com",
"CONTENT_TYPE" => "text/html",
"HTTP_REFERER" => "/some/page" }, @headers.env)
......
......@@ -187,7 +187,7 @@ def self.sanitize_sql(args)
end
relation = Relation.new(klass)
relation.merge!(where: ["foo = ?", "bar"]) # rubocop:disable Performance/RedundantMerge
relation.merge!(where: ["foo = ?", "bar"])
assert_equal Relation::WhereClause.new(["foo = bar"]), relation.where_clause
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册