Commit db7533b1 authored by Shubham Kumar's avatar Shubham Kumar Committed by Vitali Tatarintev

Resolve RuboCop offenses for Style/RedundantRegexpCharacterClass [RUN AS-IF-FOSS]

parent 2b299cf2
...@@ -859,20 +859,6 @@ Style/RedundantFetchBlock: ...@@ -859,20 +859,6 @@ Style/RedundantFetchBlock:
Style/RedundantInterpolation: Style/RedundantInterpolation:
Enabled: false Enabled: false
# Offense count: 10
# Cop supports --auto-correct.
Style/RedundantRegexpCharacterClass:
Exclude:
- 'app/models/concerns/taskable.rb'
- 'ee/app/models/saml_provider.rb'
- 'lib/banzai/filter/markdown_pre_escape_filter.rb'
- 'lib/gitlab/authorized_keys.rb'
- 'lib/gitlab/fogbugz_import/repository.rb'
- 'lib/gitlab/quick_actions/substitution_definition.rb'
- 'lib/gitlab/regex.rb'
- 'spec/features/merge_request/user_views_open_merge_request_spec.rb'
- 'spec/tasks/gitlab/usage_data_rake_spec.rb'
# Offense count: 279 # Offense count: 279
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/RedundantRegexpEscape: Style/RedundantRegexpEscape:
......
...@@ -12,7 +12,7 @@ module Taskable ...@@ -12,7 +12,7 @@ module Taskable
COMPLETED = 'completed' COMPLETED = 'completed'
INCOMPLETE = 'incomplete' INCOMPLETE = 'incomplete'
COMPLETE_PATTERN = /(\[[xX]\])/.freeze COMPLETE_PATTERN = /(\[[xX]\])/.freeze
INCOMPLETE_PATTERN = /(\[[\s]\])/.freeze INCOMPLETE_PATTERN = /(\[\s\])/.freeze
ITEM_PATTERN = %r{ ITEM_PATTERN = %r{
^ ^
(?:(?:>\s{0,4})*) # optional blockquote characters (?:(?:>\s{0,4})*) # optional blockquote characters
......
---
title: Resolve RuboCop offenses for Style/RedundantRegexpCharacterClass
merge_request: 57914
author: Shubham Kumar @imskr
type: fixed
...@@ -109,6 +109,6 @@ class SamlProvider < ApplicationRecord ...@@ -109,6 +109,6 @@ class SamlProvider < ApplicationRecord
end end
def strip_left_to_right_chars(input) def strip_left_to_right_chars(input)
input&.gsub(/[\u200E]/, '') input&.gsub(/\u200E/, '')
end end
end end
...@@ -26,7 +26,7 @@ module Banzai ...@@ -26,7 +26,7 @@ module Banzai
class MarkdownPreEscapeFilter < HTML::Pipeline::TextFilter class MarkdownPreEscapeFilter < HTML::Pipeline::TextFilter
# We just need to target those that are special GitLab references # We just need to target those that are special GitLab references
REFERENCE_CHARACTERS = '@#!$&~%^' REFERENCE_CHARACTERS = '@#!$&~%^'
ASCII_PUNCTUATION = %r{([\\][#{REFERENCE_CHARACTERS}])}.freeze ASCII_PUNCTUATION = %r{(\\[#{REFERENCE_CHARACTERS}])}.freeze
LITERAL_KEYWORD = 'cmliteral' LITERAL_KEYWORD = 'cmliteral'
def call def call
......
...@@ -161,7 +161,7 @@ module Gitlab ...@@ -161,7 +161,7 @@ module Gitlab
end end
def strip(key) def strip(key)
key.split(/[ ]+/)[0, 2].join(' ') key.split(/ +/)[0, 2].join(' ')
end end
end end
end end
...@@ -26,7 +26,7 @@ module Gitlab ...@@ -26,7 +26,7 @@ module Gitlab
end end
def path def path
safe_name.gsub(/[\s]/, '_') safe_name.gsub(/\s/, '_')
end end
end end
end end
......
...@@ -13,7 +13,7 @@ module Gitlab ...@@ -13,7 +13,7 @@ module Gitlab
return unless content return unless content
all_names.each do |a_name| all_names.each do |a_name|
content = content.sub(%r{/#{a_name}(?![\S]) ?(.*)$}i, execute_block(action_block, context, '\1')) content = content.sub(%r{/#{a_name}(?!\S) ?(.*)$}i, execute_block(action_block, context, '\1'))
end end
content content
......
...@@ -237,7 +237,7 @@ module Gitlab ...@@ -237,7 +237,7 @@ module Gitlab
# used as a routing constraint. # used as a routing constraint.
# #
def container_registry_tag_regex def container_registry_tag_regex
@container_registry_tag_regex ||= /[\w][\w.-]{0,127}/ @container_registry_tag_regex ||= /\w[\w.-]{0,127}/
end end
def environment_name_regex_chars def environment_name_regex_chars
......
...@@ -76,7 +76,7 @@ RSpec.describe 'User views an open merge request' do ...@@ -76,7 +76,7 @@ RSpec.describe 'User views an open merge request' do
it 'does not show diverged commits count' do it 'does not show diverged commits count' do
page.within('.mr-source-target') do page.within('.mr-source-target') do
expect(page).not_to have_content(/([0-9]+ commit[s]? behind)/) expect(page).not_to have_content(/([0-9]+ commits? behind)/)
end end
end end
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