提交 d3fd5857 编写于 作者: R Robert Speicher

Merge branch 'rs-start-with' into 'master'

Enable Performance/StartWith cop and fix offenses

Ref: https://gitlab.com/gitlab-org/gitlab-ce/issues/17478

See merge request !4256
......@@ -985,11 +985,10 @@ Performance/RedundantMerge:
Performance/RedundantSortBy:
Enabled: false
# TODO: Enable StartWith Cop.
# Use `start_with?` instead of a regex match anchored to the beginning of a
# string.
Performance/StartWith:
Enabled: false
Enabled: true
# Use `tr` instead of `gsub` when you are replacing the same number of
# characters. Use `delete` instead of `gsub` when you are deleting
......
......@@ -13,7 +13,7 @@ module GitlabMarkdownHelper
def link_to_gfm(body, url, html_options = {})
return "" if body.blank?
escaped_body = if body =~ /\A\<img/
escaped_body = if body.start_with?('<img')
body
else
escape_once(body)
......
......@@ -112,7 +112,7 @@ module TabHelper
end
def profile_tab_class
if controller.controller_path =~ /\Aprofiles/
if controller.controller_path.start_with?('profiles')
return 'active'
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册