Skip to content
Snippets Groups Projects
Commit f93b2e02 authored by Stan Hu's avatar Stan Hu
Browse files

Run rubocop -a on CE files

parent a5620a0d
No related branches found
No related tags found
No related merge requests found
Showing
with 16 additions and 23 deletions
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module Gitlab
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ module Gitlab
mr: :merge_request
}).freeze
 
OPTION_MATCHER = /(?<namespace>[^\.]+)\.(?<key>[^=]+)=?(?<value>.*)/
OPTION_MATCHER = /(?<namespace>[^\.]+)\.(?<key>[^=]+)=?(?<value>.*)/.freeze
 
attr_reader :options
 
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@ module Gitlab
# if date doesn't present return time with current date
# in other cases return nil
class SpendTimeAndDateSeparator
DATE_REGEX = %r{(\d{2,4}[/\-.]\d{1,2}[/\-.]\d{1,2})}
DATE_REGEX = %r{(\d{2,4}[/\-.]\d{1,2}[/\-.]\d{1,2})}.freeze
 
def initialize(spend_command_arg)
@spend_arg = spend_command_arg
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@ module Gitlab
 
class Scrubber < Loofah::Scrubber
# http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data-with-the-data-*-attributes
DATA_ATTR_PATTERN = /\Adata-(?!xml)[a-z_][\w.\u00E0-\u00F6\u00F8-\u017F\u01DD-\u02AF-]*\z/u
DATA_ATTR_PATTERN = /\Adata-(?!xml)[a-z_][\w.\u00E0-\u00F6\u00F8-\u017F\u01DD-\u02AF-]*\z/u.freeze
 
def scrub(node)
unless Whitelist::ALLOWED_ELEMENTS.include?(node.name)
Loading
Loading
Loading
Loading
@@ -4,9 +4,9 @@ module Gitlab
module Sherlock
# Rack middleware used for tracking request metrics.
class Middleware
CONTENT_TYPES = %r{text/html|application/json}i
CONTENT_TYPES = %r{text/html|application/json}i.freeze
 
IGNORE_PATHS = %r{^/sherlock}
IGNORE_PATHS = %r{^/sherlock}.freeze
 
def initialize(app)
@app = app
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ module Gitlab
|GROUP\s+BY
|ORDER\s+BY
|LIMIT
|OFFSET)\s+}ix # Vim indent breaks when this is on a newline :<
|OFFSET)\s+}ix.freeze # Vim indent breaks when this is on a newline :<
 
# Creates a new Query using a String and a separate Array of bindings.
#
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module Gitlab
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@ module Gitlab
extend ActiveSupport::Concern
 
MIN_CHARS_FOR_PARTIAL_MATCHING = 3
REGEX_QUOTED_WORD = /(?<=\A| )"[^"]+"(?= |\z)/
REGEX_QUOTED_WORD = /(?<=\A| )"[^"]+"(?= |\z)/.freeze
 
class_methods do
def fuzzy_search(query, columns)
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ module Gitlab
class UserExtractor
# Not using `Devise.email_regexp` to filter out any chars that an email
# does not end with and not pinning the email to a start of end of a string.
EMAIL_REGEXP = /(?<email>([^@\s]+@[^@\s]+(?<!\W)))/
EMAIL_REGEXP = /(?<email>([^@\s]+@[^@\s]+(?<!\W)))/.freeze
USERNAME_REGEXP = User.reference_pattern
 
def initialize(text)
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
unless Rails.env.production?
Loading
Loading
Loading
Loading
@@ -209,7 +209,7 @@ namespace :gemojione do
image.destroy!
end
 
EMOJI_IMAGE_PATH_RE = /(.*?)(([0-9a-f]-?)+)\.png$/i
EMOJI_IMAGE_PATH_RE = /(.*?)(([0-9a-f]-?)+)\.png$/i.freeze
def rename_to_named_emoji_image!(emoji_unicode_string_to_name_map, image_path)
# Rename file from unicode to emoji name
matches = EMOJI_IMAGE_PATH_RE.match(image_path)
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module QA
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module QA
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module QA
Loading
Loading
# rubocop:disable Naming/FileName
require_relative 'cop/gitlab/module_with_instance_variables'
require_relative 'cop/gitlab/predicate_memoization'
require_relative 'cop/gitlab/httparty'
Loading
Loading
Loading
Loading
@@ -6,8 +6,8 @@ describe 'create_tokens' do
 
let(:secrets) { ActiveSupport::OrderedOptions.new }
 
HEX_KEY = /\h{128}/
RSA_KEY = /\A-----BEGIN RSA PRIVATE KEY-----\n.+\n-----END RSA PRIVATE KEY-----\n\Z/m
HEX_KEY = /\h{128}/.freeze
RSA_KEY = /\A-----BEGIN RSA PRIVATE KEY-----\n.+\n-----END RSA PRIVATE KEY-----\n\Z/m.freeze
 
before do
allow(File).to receive(:write)
Loading
Loading
Loading
Loading
@@ -120,10 +120,10 @@ describe Gitlab::PathRegex do
# - Followed by one or more path-parts not starting with `:` or `*`
# - Followed by a path-part that includes a wildcard parameter `*`
# At the time of writing these routes match: http://rubular.com/r/Rv2pDE5Dvw
STARTING_WITH_NAMESPACE = %r{^/\*namespace_id/:(project_)?id}
NON_PARAM_PARTS = %r{[^:*][a-z\-_/]*}
ANY_OTHER_PATH_PART = %r{[a-z\-_/:]*}
WILDCARD_SEGMENT = /\*/
STARTING_WITH_NAMESPACE = %r{^/\*namespace_id/:(project_)?id}.freeze
NON_PARAM_PARTS = %r{[^:*][a-z\-_/]*}.freeze
ANY_OTHER_PATH_PART = %r{[a-z\-_/:]*}.freeze
WILDCARD_SEGMENT = /\*/.freeze
let(:namespaced_wildcard_routes) do
routes_without_format.select do |p|
p =~ %r{#{STARTING_WITH_NAMESPACE}/#{NON_PARAM_PARTS}/#{ANY_OTHER_PATH_PART}#{WILDCARD_SEGMENT}}
Loading
Loading
@@ -144,7 +144,7 @@ describe Gitlab::PathRegex do
end.uniq
end
 
STARTING_WITH_GROUP = %r{^/groups/\*(group_)?id/}
STARTING_WITH_GROUP = %r{^/groups/\*(group_)?id/}.freeze
let(:group_routes) do
routes_without_format.select do |path|
path =~ STARTING_WITH_GROUP
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment