diff options
author | Takuya Noguchi <takninnovationresearch@gmail.com> | 2018-01-27 14:35:53 +0900 |
---|---|---|
committer | Takuya Noguchi <takninnovationresearch@gmail.com> | 2018-02-01 02:06:07 +0900 |
commit | 2b6307f6ad9d09156c42befe4babbfea40dad052 (patch) | |
tree | 2a05eb3e7a481ed803ea62a2d4e7667baff44375 /lib/banzai | |
parent | 08e013431acb5238b4806260c4b9c304837097a3 (diff) | |
download | gitlab-ce-2b6307f6ad9d09156c42befe4babbfea40dad052.tar.gz |
Enable RuboCop Style/RegexpLiteral
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/filter/emoji_filter.rb | 4 | ||||
-rw-r--r-- | lib/banzai/filter/gollum_tags_filter.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/banzai/filter/emoji_filter.rb b/lib/banzai/filter/emoji_filter.rb index 6255a611dbe..b82c6ca6393 100644 --- a/lib/banzai/filter/emoji_filter.rb +++ b/lib/banzai/filter/emoji_filter.rb @@ -54,9 +54,9 @@ module Banzai # Build a regexp that matches all valid :emoji: names. def self.emoji_pattern @emoji_pattern ||= - /(?<=[^[:alnum:]:]|\n|^) + %r{(?<=[^[:alnum:]:]|\n|^) :(#{Gitlab::Emoji.emojis_names.map { |name| Regexp.escape(name) }.join('|')}): - (?=[^[:alnum:]:]|$)/x + (?=[^[:alnum:]:]|$)}x end # Build a regexp that matches all valid unicode emojis names. diff --git a/lib/banzai/filter/gollum_tags_filter.rb b/lib/banzai/filter/gollum_tags_filter.rb index 2e259904673..c2b42673376 100644 --- a/lib/banzai/filter/gollum_tags_filter.rb +++ b/lib/banzai/filter/gollum_tags_filter.rb @@ -51,10 +51,10 @@ module Banzai # See https://github.com/gollum/gollum/wiki # # Rubular: http://rubular.com/r/7dQnE5CUCH - TAGS_PATTERN = %r{\[\[(.+?)\]\]}.freeze + TAGS_PATTERN = /\[\[(.+?)\]\]/.freeze # Pattern to match allowed image extensions - ALLOWED_IMAGE_EXTENSIONS = %r{.+(jpg|png|gif|svg|bmp)\z}i.freeze + ALLOWED_IMAGE_EXTENSIONS = /.+(jpg|png|gif|svg|bmp)\z/i.freeze def call search_text_nodes(doc).each do |node| |