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 18 additions and 26 deletions
Loading
Loading
@@ -33,7 +33,7 @@ module Banzai
(?<new_link>.+?)
(?<title>\ ".+?")?
\)
}x
}x.freeze
 
# Text matching LINK_OR_IMAGE_PATTERN inside these elements will not be linked
IGNORE_PARENTS = %w(a code kbd pre script style).to_set
Loading
Loading
Loading
Loading
@@ -17,7 +17,7 @@ module Banzai
# :toc - String containing Table of Contents data as a `ul` element with
# `li` child elements.
class TableOfContentsFilter < HTML::Pipeline::Filter
PUNCTUATION_REGEXP = /[^\p{Word}\- ]/u
PUNCTUATION_REGEXP = /[^\p{Word}\- ]/u.freeze
 
def call
return doc if context[:no_header_anchors]
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module DeclarativePolicy
Loading
Loading
Loading
Loading
@@ -36,8 +36,8 @@ module Gitlab
end
 
COM_URL = 'https://gitlab.com'.freeze
APP_DIRS_PATTERN = %r{^/?(app|config|ee|lib|spec|\(\w*\))}
SUBDOMAIN_REGEX = %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}
APP_DIRS_PATTERN = %r{^/?(app|config|ee|lib|spec|\(\w*\))}.freeze
SUBDOMAIN_REGEX = %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}.freeze
VERSION = File.read(root.join("VERSION")).strip.freeze
INSTALLATION_TYPE = File.read(root.join("INSTALLATION_TYPE")).strip.freeze
 
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module Gitlab
Loading
Loading
Loading
Loading
@@ -8,8 +8,8 @@ module Gitlab
self.table_name = 'untracked_files_for_uploads'
 
# Ends with /:random_hex/:filename
FILE_UPLOADER_PATH = %r{/\h+/[^/]+\z}
FULL_PATH_CAPTURE = /\A(.+)#{FILE_UPLOADER_PATH}/
FILE_UPLOADER_PATH = %r{/\h+/[^/]+\z}.freeze
FULL_PATH_CAPTURE = /\A(.+)#{FILE_UPLOADER_PATH}/.freeze
 
# These regex patterns are tested against a relative path, relative to
# the upload directory.
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ module Gitlab
RELATIVE_UPLOAD_DIR
)
FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'.freeze
START_WITH_ROOT_REGEX = %r{\A#{Gitlab.config.uploads.storage_path}/}
START_WITH_ROOT_REGEX = %r{\A#{Gitlab.config.uploads.storage_path}/}.freeze
EXCLUDED_HASHED_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/@hashed/*".freeze
EXCLUDED_TMP_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/tmp/*".freeze
 
Loading
Loading
Loading
Loading
@@ -11,8 +11,8 @@ module Gitlab
ParserError = Class.new(StandardError)
InvalidStreamError = Class.new(StandardError)
 
VERSION_PATTERN = /^[\w\s]+(\d+\.\d+\.\d+)/
INVALID_PATH_PATTERN = %r{(^\.?\.?/)|(/\.?\.?/)}
VERSION_PATTERN = /^[\w\s]+(\d+\.\d+\.\d+)/.freeze
INVALID_PATH_PATTERN = %r{(^\.?\.?/)|(/\.?\.?/)}.freeze
 
attr_reader :stream, :path, :full_version
 
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module Gitlab
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ module Gitlab
class Skip < Chain::Base
include ::Gitlab::Utils::StrongMemoize
 
SKIP_PATTERN = /\[(ci[ _-]skip|skip[ _-]ci)\]/i
SKIP_PATTERN = /\[(ci[ _-]skip|skip[ _-]ci)\]/i.freeze
 
def perform!
if skipped?
Loading
Loading
Loading
Loading
@@ -22,13 +22,13 @@ module Gitlab
end
 
# rubocop:disable Style/VariableInterpolation
TRADITIONAL_ESCAPED_CHAR = /[^ A-Za-z0-9!#$+.^_`|~-]/
TRADITIONAL_ESCAPED_CHAR = /[^ A-Za-z0-9!#$+.^_`|~-]/.freeze
 
def ascii_filename
'filename="' + percent_escape(::I18n.transliterate(filename), TRADITIONAL_ESCAPED_CHAR) + '"'
end
 
RFC_5987_ESCAPED_CHAR = /[^A-Za-z0-9!#$&+.^_`|~-]/
RFC_5987_ESCAPED_CHAR = /[^A-Za-z0-9!#$&+.^_`|~-]/.freeze
# rubocop:enable Style/VariableInterpolation
 
def utf8_filename
Loading
Loading
Loading
Loading
@@ -103,8 +103,6 @@ module Gitlab
none: "",
qa: "~QA"
}.freeze
# rubocop:disable Style/RegexpLiteral
CATEGORIES = {
%r{\Adoc/} => :none, # To reinstate roulette for documentation, set to `:docs`.
%r{\A(CONTRIBUTING|LICENSE|MAINTENANCE|PHILOSOPHY|PROCESS|README)(\.md)?\z} => :none, # To reinstate roulette for documentation, set to `:docs`.
Loading
Loading
@@ -151,7 +149,6 @@ module Gitlab
%r{\.(md|txt)\z} => :none, # To reinstate roulette for documentation, set to `:docs`.
%r{\.js\z} => :frontend
}.freeze
# rubocop:enable Style/RegexpLiteral
end
end
end
Loading
Loading
@@ -14,7 +14,7 @@ module Gitlab
'GL-HOOK-ERR:' # Messages marked as safe by user
].freeze
 
SAFE_MESSAGE_REGEX = /^(#{SAFE_MESSAGE_PREFIXES.join('|')})\s*(?<safe_message>.+)/
SAFE_MESSAGE_REGEX = /^(#{SAFE_MESSAGE_PREFIXES.join('|')})\s*(?<safe_message>.+)/.freeze
 
def initialize(message = '')
super(sanitize(message))
Loading
Loading
Loading
Loading
@@ -26,7 +26,7 @@ module Gitlab
end
end
 
PEM_REGEX = /\-+BEGIN CERTIFICATE\-+.+?\-+END CERTIFICATE\-+/m
PEM_REGEX = /\-+BEGIN CERTIFICATE\-+.+?\-+END CERTIFICATE\-+/m.freeze
SERVER_VERSION_FILE = 'GITALY_SERVER_VERSION'
MAXIMUM_GITALY_CALLS = 30
CLIENT_NAME = (Sidekiq.server? ? 'gitlab-sidekiq' : 'gitlab-web').freeze
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@ module Gitlab
:diff_hunk, :author, :note, :created_at, :updated_at,
:github_id
 
NOTEABLE_ID_REGEX = %r{/pull/(?<iid>\d+)}i
NOTEABLE_ID_REGEX = %r{/pull/(?<iid>\d+)}i.freeze
 
# Builds a diff note from a GitHub API response.
#
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ module Gitlab
expose_attribute :noteable_id, :noteable_type, :author, :note,
:created_at, :updated_at, :github_id
 
NOTEABLE_TYPE_REGEX = %r{/(?<type>(pull|issues))/(?<iid>\d+)}i
NOTEABLE_TYPE_REGEX = %r{/(?<type>(pull|issues))/(?<iid>\d+)}i.freeze
 
# Builds a note from a GitHub API response.
#
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module Gitlab::HealthChecks
Loading
Loading
# rubocop:disable Naming/FileName
# frozen_string_literal: true
 
module Gitlab::HealthChecks
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ module Gitlab
module Metrics
# Class for storing details of a single metric (label, value, etc).
class Metric
JITTER_RANGE = 0.000001..0.001
JITTER_RANGE = (0.000001..0.001).freeze
 
attr_reader :series, :values, :tags, :type
 
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@
module Gitlab
module Middleware
class ReadOnly
API_VERSIONS = (3..4)
API_VERSIONS = (3..4).freeze
 
def self.internal_routes
@internal_routes ||=
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