Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
c858f70d
Commit
c858f70d
authored
Oct 22, 2018
by
gfyoung
Committed by
Rémy Coutable
Oct 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable frozen string for lib/gitlab/*.rb
parent
173b1436
Changes
151
Show whitespace changes
Inline
Side-by-side
Showing
151 changed files
with
327 additions
and
22 deletions
+327
-22
changelogs/unreleased/frozen-string-enable-lib-gitlab.yml
changelogs/unreleased/frozen-string-enable-lib-gitlab.yml
+5
-0
lib/backup/manager.rb
lib/backup/manager.rb
+1
-1
lib/gitlab/access.rb
lib/gitlab/access.rb
+2
-0
lib/gitlab/action_rate_limiter.rb
lib/gitlab/action_rate_limiter.rb
+2
-0
lib/gitlab/allowable.rb
lib/gitlab/allowable.rb
+2
-0
lib/gitlab/app_logger.rb
lib/gitlab/app_logger.rb
+2
-0
lib/gitlab/asciidoc.rb
lib/gitlab/asciidoc.rb
+2
-0
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+2
-0
lib/gitlab/background_migration.rb
lib/gitlab/background_migration.rb
+2
-0
lib/gitlab/base_doorkeeper_controller.rb
lib/gitlab/base_doorkeeper_controller.rb
+2
-0
lib/gitlab/blame.rb
lib/gitlab/blame.rb
+2
-0
lib/gitlab/blob_helper.rb
lib/gitlab/blob_helper.rb
+2
-0
lib/gitlab/build_access.rb
lib/gitlab/build_access.rb
+2
-0
lib/gitlab/changes_list.rb
lib/gitlab/changes_list.rb
+2
-0
lib/gitlab/chat_name_token.rb
lib/gitlab/chat_name_token.rb
+2
-0
lib/gitlab/ci_access.rb
lib/gitlab/ci_access.rb
+2
-0
lib/gitlab/closing_issue_extractor.rb
lib/gitlab/closing_issue_extractor.rb
+2
-0
lib/gitlab/color_schemes.rb
lib/gitlab/color_schemes.rb
+2
-0
lib/gitlab/config_helper.rb
lib/gitlab/config_helper.rb
+2
-0
lib/gitlab/contributions_calendar.rb
lib/gitlab/contributions_calendar.rb
+2
-0
lib/gitlab/contributor.rb
lib/gitlab/contributor.rb
+2
-0
lib/gitlab/cross_project_access.rb
lib/gitlab/cross_project_access.rb
+2
-0
lib/gitlab/current_settings.rb
lib/gitlab/current_settings.rb
+2
-0
lib/gitlab/daemon.rb
lib/gitlab/daemon.rb
+2
-0
lib/gitlab/database.rb
lib/gitlab/database.rb
+7
-5
lib/gitlab/dependency_linker.rb
lib/gitlab/dependency_linker.rb
+2
-0
lib/gitlab/downtime_check.rb
lib/gitlab/downtime_check.rb
+2
-0
lib/gitlab/ee_compat_check.rb
lib/gitlab/ee_compat_check.rb
+2
-0
lib/gitlab/emoji.rb
lib/gitlab/emoji.rb
+2
-0
lib/gitlab/encoding_helper.rb
lib/gitlab/encoding_helper.rb
+2
-0
lib/gitlab/environment.rb
lib/gitlab/environment.rb
+2
-0
lib/gitlab/environment_logger.rb
lib/gitlab/environment_logger.rb
+2
-0
lib/gitlab/exclusive_lease.rb
lib/gitlab/exclusive_lease.rb
+2
-0
lib/gitlab/exclusive_lease_helpers.rb
lib/gitlab/exclusive_lease_helpers.rb
+2
-0
lib/gitlab/fake_application_settings.rb
lib/gitlab/fake_application_settings.rb
+2
-0
lib/gitlab/favicon.rb
lib/gitlab/favicon.rb
+2
-0
lib/gitlab/file_detector.rb
lib/gitlab/file_detector.rb
+2
-0
lib/gitlab/file_finder.rb
lib/gitlab/file_finder.rb
+2
-0
lib/gitlab/file_markdown_link_builder.rb
lib/gitlab/file_markdown_link_builder.rb
+3
-1
lib/gitlab/git.rb
lib/gitlab/git.rb
+2
-0
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+2
-0
lib/gitlab/git_access_wiki.rb
lib/gitlab/git_access_wiki.rb
+2
-0
lib/gitlab/git_logger.rb
lib/gitlab/git_logger.rb
+2
-0
lib/gitlab/git_ref_validator.rb
lib/gitlab/git_ref_validator.rb
+2
-0
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+3
-1
lib/gitlab/github_import.rb
lib/gitlab/github_import.rb
+2
-0
lib/gitlab/gl_id.rb
lib/gitlab/gl_id.rb
+2
-0
lib/gitlab/gl_repository.rb
lib/gitlab/gl_repository.rb
+2
-0
lib/gitlab/gon_helper.rb
lib/gitlab/gon_helper.rb
+2
-0
lib/gitlab/gpg.rb
lib/gitlab/gpg.rb
+2
-0
lib/gitlab/graphql.rb
lib/gitlab/graphql.rb
+2
-0
lib/gitlab/group_hierarchy.rb
lib/gitlab/group_hierarchy.rb
+2
-0
lib/gitlab/highlight.rb
lib/gitlab/highlight.rb
+2
-0
lib/gitlab/http.rb
lib/gitlab/http.rb
+2
-0
lib/gitlab/http_io.rb
lib/gitlab/http_io.rb
+9
-6
lib/gitlab/i18n.rb
lib/gitlab/i18n.rb
+2
-0
lib/gitlab/identifier.rb
lib/gitlab/identifier.rb
+2
-0
lib/gitlab/import_export.rb
lib/gitlab/import_export.rb
+2
-0
lib/gitlab/import_formatter.rb
lib/gitlab/import_formatter.rb
+2
-0
lib/gitlab/import_sources.rb
lib/gitlab/import_sources.rb
+2
-0
lib/gitlab/incoming_email.rb
lib/gitlab/incoming_email.rb
+2
-0
lib/gitlab/insecure_key_fingerprint.rb
lib/gitlab/insecure_key_fingerprint.rb
+2
-0
lib/gitlab/issuable_metadata.rb
lib/gitlab/issuable_metadata.rb
+2
-0
lib/gitlab/issuable_sorter.rb
lib/gitlab/issuable_sorter.rb
+2
-0
lib/gitlab/issuables_count_for_state.rb
lib/gitlab/issuables_count_for_state.rb
+2
-0
lib/gitlab/issues_labels.rb
lib/gitlab/issues_labels.rb
+2
-0
lib/gitlab/job_waiter.rb
lib/gitlab/job_waiter.rb
+2
-0
lib/gitlab/json_logger.rb
lib/gitlab/json_logger.rb
+2
-0
lib/gitlab/kubernetes.rb
lib/gitlab/kubernetes.rb
+2
-0
lib/gitlab/language_detection.rb
lib/gitlab/language_detection.rb
+2
-0
lib/gitlab/lazy.rb
lib/gitlab/lazy.rb
+2
-0
lib/gitlab/lfs_token.rb
lib/gitlab/lfs_token.rb
+2
-0
lib/gitlab/logger.rb
lib/gitlab/logger.rb
+2
-0
lib/gitlab/mail_room.rb
lib/gitlab/mail_room.rb
+2
-0
lib/gitlab/markup_helper.rb
lib/gitlab/markup_helper.rb
+2
-0
lib/gitlab/metrics.rb
lib/gitlab/metrics.rb
+2
-0
lib/gitlab/multi_collection_paginator.rb
lib/gitlab/multi_collection_paginator.rb
+2
-0
lib/gitlab/omniauth_initializer.rb
lib/gitlab/omniauth_initializer.rb
+2
-0
lib/gitlab/optimistic_locking.rb
lib/gitlab/optimistic_locking.rb
+2
-0
lib/gitlab/other_markup.rb
lib/gitlab/other_markup.rb
+2
-0
lib/gitlab/otp_key_rotator.rb
lib/gitlab/otp_key_rotator.rb
+2
-0
lib/gitlab/pages.rb
lib/gitlab/pages.rb
+2
-0
lib/gitlab/pages_client.rb
lib/gitlab/pages_client.rb
+2
-0
lib/gitlab/pages_transfer.rb
lib/gitlab/pages_transfer.rb
+2
-0
lib/gitlab/path_regex.rb
lib/gitlab/path_regex.rb
+2
-0
lib/gitlab/performance_bar.rb
lib/gitlab/performance_bar.rb
+2
-0
lib/gitlab/plugin.rb
lib/gitlab/plugin.rb
+2
-0
lib/gitlab/plugin_logger.rb
lib/gitlab/plugin_logger.rb
+2
-0
lib/gitlab/polling_interval.rb
lib/gitlab/polling_interval.rb
+2
-0
lib/gitlab/popen.rb
lib/gitlab/popen.rb
+3
-1
lib/gitlab/profiler.rb
lib/gitlab/profiler.rb
+2
-0
lib/gitlab/project_search_results.rb
lib/gitlab/project_search_results.rb
+5
-2
lib/gitlab/project_service_logger.rb
lib/gitlab/project_service_logger.rb
+2
-0
lib/gitlab/project_template.rb
lib/gitlab/project_template.rb
+2
-0
lib/gitlab/project_transfer.rb
lib/gitlab/project_transfer.rb
+2
-0
lib/gitlab/prometheus_client.rb
lib/gitlab/prometheus_client.rb
+2
-0
lib/gitlab/protocol_access.rb
lib/gitlab/protocol_access.rb
+2
-0
lib/gitlab/proxy_http_connection_adapter.rb
lib/gitlab/proxy_http_connection_adapter.rb
+2
-0
lib/gitlab/query_limiting.rb
lib/gitlab/query_limiting.rb
+2
-0
lib/gitlab/recaptcha.rb
lib/gitlab/recaptcha.rb
+2
-0
lib/gitlab/reference_counter.rb
lib/gitlab/reference_counter.rb
+2
-0
lib/gitlab/reference_extractor.rb
lib/gitlab/reference_extractor.rb
+2
-0
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+2
-0
lib/gitlab/repo_path.rb
lib/gitlab/repo_path.rb
+2
-0
lib/gitlab/repository_cache.rb
lib/gitlab/repository_cache.rb
+3
-1
lib/gitlab/repository_cache_adapter.rb
lib/gitlab/repository_cache_adapter.rb
+2
-0
lib/gitlab/repository_check_logger.rb
lib/gitlab/repository_check_logger.rb
+2
-0
lib/gitlab/request_context.rb
lib/gitlab/request_context.rb
+2
-0
lib/gitlab/request_forgery_protection.rb
lib/gitlab/request_forgery_protection.rb
+2
-0
lib/gitlab/request_profiler.rb
lib/gitlab/request_profiler.rb
+2
-0
lib/gitlab/route_map.rb
lib/gitlab/route_map.rb
+2
-0
lib/gitlab/routing.rb
lib/gitlab/routing.rb
+3
-1
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+2
-0
lib/gitlab/seeder.rb
lib/gitlab/seeder.rb
+2
-0
lib/gitlab/sentry.rb
lib/gitlab/sentry.rb
+2
-0
lib/gitlab/setup_helper.rb
lib/gitlab/setup_helper.rb
+2
-0
lib/gitlab/shard_health_cache.rb
lib/gitlab/shard_health_cache.rb
+2
-0
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+2
-0
lib/gitlab/shell_adapter.rb
lib/gitlab/shell_adapter.rb
+2
-0
lib/gitlab/sherlock.rb
lib/gitlab/sherlock.rb
+2
-0
lib/gitlab/sidekiq_config.rb
lib/gitlab/sidekiq_config.rb
+2
-0
lib/gitlab/sidekiq_logger.rb
lib/gitlab/sidekiq_logger.rb
+2
-0
lib/gitlab/sidekiq_status.rb
lib/gitlab/sidekiq_status.rb
+2
-0
lib/gitlab/sidekiq_versioning.rb
lib/gitlab/sidekiq_versioning.rb
+2
-0
lib/gitlab/snippet_search_results.rb
lib/gitlab/snippet_search_results.rb
+2
-0
lib/gitlab/ssh_public_key.rb
lib/gitlab/ssh_public_key.rb
+3
-1
lib/gitlab/string_placeholder_replacer.rb
lib/gitlab/string_placeholder_replacer.rb
+2
-0
lib/gitlab/string_range_marker.rb
lib/gitlab/string_range_marker.rb
+2
-0
lib/gitlab/string_regex_marker.rb
lib/gitlab/string_regex_marker.rb
+2
-0
lib/gitlab/task_helpers.rb
lib/gitlab/task_helpers.rb
+3
-1
lib/gitlab/tcp_checker.rb
lib/gitlab/tcp_checker.rb
+2
-0
lib/gitlab/template_helper.rb
lib/gitlab/template_helper.rb
+2
-0
lib/gitlab/temporarily_allow.rb
lib/gitlab/temporarily_allow.rb
+2
-0
lib/gitlab/themes.rb
lib/gitlab/themes.rb
+2
-0
lib/gitlab/time_tracking_formatter.rb
lib/gitlab/time_tracking_formatter.rb
+2
-0
lib/gitlab/timeless.rb
lib/gitlab/timeless.rb
+2
-0
lib/gitlab/tree_summary.rb
lib/gitlab/tree_summary.rb
+2
-0
lib/gitlab/untrusted_regexp.rb
lib/gitlab/untrusted_regexp.rb
+2
-0
lib/gitlab/update_path_error.rb
lib/gitlab/update_path_error.rb
+2
-0
lib/gitlab/upgrader.rb
lib/gitlab/upgrader.rb
+2
-0
lib/gitlab/uploads_transfer.rb
lib/gitlab/uploads_transfer.rb
+2
-0
lib/gitlab/url_blocker.rb
lib/gitlab/url_blocker.rb
+2
-0
lib/gitlab/url_builder.rb
lib/gitlab/url_builder.rb
+2
-0
lib/gitlab/url_sanitizer.rb
lib/gitlab/url_sanitizer.rb
+2
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+2
-0
lib/gitlab/user_access.rb
lib/gitlab/user_access.rb
+2
-0
lib/gitlab/utils.rb
lib/gitlab/utils.rb
+2
-0
lib/gitlab/version_info.rb
lib/gitlab/version_info.rb
+2
-0
lib/gitlab/visibility_level.rb
lib/gitlab/visibility_level.rb
+2
-0
lib/gitlab/wiki_file_finder.rb
lib/gitlab/wiki_file_finder.rb
+2
-0
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+3
-1
No files found.
changelogs/unreleased/frozen-string-enable-lib-gitlab.yml
0 → 100644
View file @
c858f70d
---
title
:
Enable frozen string for lib/gitlab/*.rb
merge_request
:
author
:
gfyoung
type
:
performance
lib/backup/manager.rb
View file @
c858f70d
...
@@ -164,7 +164,7 @@ module Backup
...
@@ -164,7 +164,7 @@ module Backup
def
tar_version
def
tar_version
tar_version
,
_
=
Gitlab
::
Popen
.
popen
(
%w(tar --version)
)
tar_version
,
_
=
Gitlab
::
Popen
.
popen
(
%w(tar --version)
)
tar_version
.
force_encoding
(
'locale'
).
split
(
"
\n
"
).
first
tar_version
.
dup
.
force_encoding
(
'locale'
).
split
(
"
\n
"
).
first
end
end
def
skipped?
(
item
)
def
skipped?
(
item
)
...
...
lib/gitlab/access.rb
View file @
c858f70d
# frozen_string_literal: true
# Gitlab::Access module
# Gitlab::Access module
#
#
# Define allowed roles that can be used
# Define allowed roles that can be used
...
...
lib/gitlab/action_rate_limiter.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# This class implements a simple rate limiter that can be used to throttle
# This class implements a simple rate limiter that can be used to throttle
# certain actions. Unlike Rack Attack and Rack::Throttle, which operate at
# certain actions. Unlike Rack Attack and Rack::Throttle, which operate at
...
...
lib/gitlab/allowable.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Allowable
module
Allowable
def
can?
(
*
args
)
def
can?
(
*
args
)
...
...
lib/gitlab/app_logger.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
AppLogger
<
Gitlab
::
Logger
class
AppLogger
<
Gitlab
::
Logger
def
self
.
file_name_noext
def
self
.
file_name_noext
...
...
lib/gitlab/asciidoc.rb
View file @
c858f70d
# frozen_string_literal: true
require
'asciidoctor'
require
'asciidoctor'
require
'asciidoctor/converter/html5'
require
'asciidoctor/converter/html5'
require
"asciidoctor-plantuml"
require
"asciidoctor-plantuml"
...
...
lib/gitlab/auth.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Auth
module
Auth
MissingPersonalAccessTokenError
=
Class
.
new
(
StandardError
)
MissingPersonalAccessTokenError
=
Class
.
new
(
StandardError
)
...
...
lib/gitlab/background_migration.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
BackgroundMigration
module
BackgroundMigration
def
self
.
queue
def
self
.
queue
...
...
lib/gitlab/base_doorkeeper_controller.rb
View file @
c858f70d
# frozen_string_literal: true
# This is a base controller for doorkeeper.
# This is a base controller for doorkeeper.
# It adds the `can?` helper used in the views.
# It adds the `can?` helper used in the views.
module
Gitlab
module
Gitlab
...
...
lib/gitlab/blame.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
Blame
class
Blame
attr_accessor
:blob
,
:commit
attr_accessor
:blob
,
:commit
...
...
lib/gitlab/blob_helper.rb
View file @
c858f70d
# frozen_string_literal: true
# This has been extracted from https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb
# This has been extracted from https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb
module
Gitlab
module
Gitlab
module
BlobHelper
module
BlobHelper
...
...
lib/gitlab/build_access.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
BuildAccess
<
UserAccess
class
BuildAccess
<
UserAccess
attr_accessor
:user
,
:project
attr_accessor
:user
,
:project
...
...
lib/gitlab/changes_list.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
ChangesList
class
ChangesList
include
Enumerable
include
Enumerable
...
...
lib/gitlab/chat_name_token.rb
View file @
c858f70d
# frozen_string_literal: true
require
'json'
require
'json'
module
Gitlab
module
Gitlab
...
...
lib/gitlab/ci_access.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# For backwards compatibility, generic CI (which is a build without a user) is
# For backwards compatibility, generic CI (which is a build without a user) is
# allowed to :build_download_code without any other checks.
# allowed to :build_download_code without any other checks.
...
...
lib/gitlab/closing_issue_extractor.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
ClosingIssueExtractor
class
ClosingIssueExtractor
ISSUE_CLOSING_REGEX
=
begin
ISSUE_CLOSING_REGEX
=
begin
...
...
lib/gitlab/color_schemes.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# Module containing GitLab's syntax color scheme definitions and helper
# Module containing GitLab's syntax color scheme definitions and helper
# methods for accessing them.
# methods for accessing them.
...
...
lib/gitlab/config_helper.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab::ConfigHelper
module
Gitlab::ConfigHelper
def
gitlab_config_features
def
gitlab_config_features
Gitlab
.
config
.
gitlab
.
default_projects_features
Gitlab
.
config
.
gitlab
.
default_projects_features
...
...
lib/gitlab/contributions_calendar.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
ContributionsCalendar
class
ContributionsCalendar
attr_reader
:contributor
attr_reader
:contributor
...
...
lib/gitlab/contributor.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
Contributor
class
Contributor
attr_accessor
:email
,
:name
,
:commits
,
:additions
,
:deletions
attr_accessor
:email
,
:name
,
:commits
,
:additions
,
:deletions
...
...
lib/gitlab/cross_project_access.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
CrossProjectAccess
class
CrossProjectAccess
class
<<
self
class
<<
self
...
...
lib/gitlab/current_settings.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
CurrentSettings
module
CurrentSettings
class
<<
self
class
<<
self
...
...
lib/gitlab/daemon.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
Daemon
class
Daemon
def
self
.
initialize_instance
(
*
args
)
def
self
.
initialize_instance
(
*
args
)
...
...
lib/gitlab/database.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Database
module
Database
# The max value of INTEGER type is the same between MySQL and PostgreSQL:
# The max value of INTEGER type is the same between MySQL and PostgreSQL:
...
@@ -99,11 +101,11 @@ module Gitlab
...
@@ -99,11 +101,11 @@ module Gitlab
order
=
"
#{
field
}
#{
direction
}
"
order
=
"
#{
field
}
#{
direction
}
"
if
postgresql?
if
postgresql?
order
<<
' NULLS LAST'
order
=
"
#{
order
}
NULLS LAST"
else
else
# `field IS NULL` will be `0` for non-NULL columns and `1` for NULL
# `field IS NULL` will be `0` for non-NULL columns and `1` for NULL
# columns. In the (default) ascending order, `0` comes first.
# columns. In the (default) ascending order, `0` comes first.
order
.
prepend
(
"
#{
field
}
IS NULL, "
)
if
direction
==
'ASC'
order
=
"
#{
field
}
IS NULL,
#{
order
}
"
if
direction
==
'ASC'
end
end
order
order
...
@@ -113,11 +115,11 @@ module Gitlab
...
@@ -113,11 +115,11 @@ module Gitlab
order
=
"
#{
field
}
#{
direction
}
"
order
=
"
#{
field
}
#{
direction
}
"
if
postgresql?
if
postgresql?
order
<<
' NULLS FIRST'
order
=
"
#{
order
}
NULLS FIRST"
else
else
# `field IS NULL` will be `0` for non-NULL columns and `1` for NULL
# `field IS NULL` will be `0` for non-NULL columns and `1` for NULL
# columns. In the (default) ascending order, `0` comes first.
# columns. In the (default) ascending order, `0` comes first.
order
.
prepend
(
"
#{
field
}
IS NULL, "
)
if
direction
==
'DESC'
order
=
"
#{
field
}
IS NULL,
#{
order
}
"
if
direction
==
'DESC'
end
end
order
order
...
@@ -184,7 +186,7 @@ module Gitlab
...
@@ -184,7 +186,7 @@ module Gitlab
EOF
EOF
if
return_ids
if
return_ids
sql
<<
'RETURNING id'
sql
=
"
#{
sql
}
RETURNING id"
end
end
result
=
connection
.
execute
(
sql
)
result
=
connection
.
execute
(
sql
)
...
...
lib/gitlab/dependency_linker.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
DependencyLinker
module
DependencyLinker
LINKERS
=
[
LINKERS
=
[
...
...
lib/gitlab/downtime_check.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# Checks if a set of migrations requires downtime or not.
# Checks if a set of migrations requires downtime or not.
class
DowntimeCheck
class
DowntimeCheck
...
...
lib/gitlab/ee_compat_check.rb
View file @
c858f70d
# frozen_string_literal: true
# rubocop: disable Rails/Output
# rubocop: disable Rails/Output
module
Gitlab
module
Gitlab
# Checks if a set of migrations requires downtime or not.
# Checks if a set of migrations requires downtime or not.
...
...
lib/gitlab/emoji.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Emoji
module
Emoji
extend
self
extend
self
...
...
lib/gitlab/encoding_helper.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
EncodingHelper
module
EncodingHelper
extend
self
extend
self
...
...
lib/gitlab/environment.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Environment
module
Environment
def
self
.
hostname
def
self
.
hostname
...
...
lib/gitlab/environment_logger.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
EnvironmentLogger
<
Gitlab
::
Logger
class
EnvironmentLogger
<
Gitlab
::
Logger
def
self
.
file_name_noext
def
self
.
file_name_noext
...
...
lib/gitlab/exclusive_lease.rb
View file @
c858f70d
# frozen_string_literal: true
require
'securerandom'
require
'securerandom'
module
Gitlab
module
Gitlab
...
...
lib/gitlab/exclusive_lease_helpers.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# This module provides helper methods which are intregrated with GitLab::ExclusiveLease
# This module provides helper methods which are intregrated with GitLab::ExclusiveLease
module
ExclusiveLeaseHelpers
module
ExclusiveLeaseHelpers
...
...
lib/gitlab/fake_application_settings.rb
View file @
c858f70d
# frozen_string_literal: true
# This class extends an OpenStruct object by adding predicate methods to mimic
# This class extends an OpenStruct object by adding predicate methods to mimic
# ActiveRecord access. We rely on the initial values being true or false to
# ActiveRecord access. We rely on the initial values being true or false to
# determine whether to define a predicate method because for a newly-added
# determine whether to define a predicate method because for a newly-added
...
...
lib/gitlab/favicon.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
Favicon
class
Favicon
class
<<
self
class
<<
self
...
...
lib/gitlab/file_detector.rb
View file @
c858f70d
# frozen_string_literal: true
require
'set'
require
'set'
module
Gitlab
module
Gitlab
...
...
lib/gitlab/file_finder.rb
View file @
c858f70d
# frozen_string_literal: true
# This class finds files in a repository by name and content
# This class finds files in a repository by name and content
# the result is joined and sorted by file name
# the result is joined and sorted by file name
module
Gitlab
module
Gitlab
...
...
lib/gitlab/file_markdown_link_builder.rb
View file @
c858f70d
# frozen_string_literal: true
# Builds the markdown link of a file
# Builds the markdown link of a file
# It needs the methods filename and secure_url (final destination url) to be defined.
# It needs the methods filename and secure_url (final destination url) to be defined.
module
Gitlab
module
Gitlab
...
@@ -8,7 +10,7 @@ module Gitlab
...
@@ -8,7 +10,7 @@ module Gitlab
return
unless
name
=
markdown_name
return
unless
name
=
markdown_name
markdown
=
"[
#{
name
.
gsub
(
']'
,
'\\]'
)
}
](
#{
secure_url
}
)"
markdown
=
"[
#{
name
.
gsub
(
']'
,
'\\]'
)
}
](
#{
secure_url
}
)"
markdown
.
prepend
(
"!"
)
if
image_or_video?
||
dangerous?
markdown
=
"!
#{
markdown
}
"
if
image_or_video?
||
dangerous?
markdown
markdown
end
end
...
...
lib/gitlab/git.rb
View file @
c858f70d
# frozen_string_literal: true
require_dependency
'gitlab/encoding_helper'
require_dependency
'gitlab/encoding_helper'
module
Gitlab
module
Gitlab
...
...
lib/gitlab/git_access.rb
View file @
c858f70d
# frozen_string_literal: true
# Check a user's access to perform a git action. All public methods in this
# Check a user's access to perform a git action. All public methods in this
# class return an instance of `GitlabAccessStatus`
# class return an instance of `GitlabAccessStatus`
module
Gitlab
module
Gitlab
...
...
lib/gitlab/git_access_wiki.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
GitAccessWiki
<
GitAccess
class
GitAccessWiki
<
GitAccess
ERROR_MESSAGES
=
{
ERROR_MESSAGES
=
{
...
...
lib/gitlab/git_logger.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
GitLogger
<
Gitlab
::
Logger
class
GitLogger
<
Gitlab
::
Logger
def
self
.
file_name_noext
def
self
.
file_name_noext
...
...
lib/gitlab/git_ref_validator.rb
View file @
c858f70d
# frozen_string_literal: true
# Gitaly note: JV: does not need to be migrated, works without a repo.
# Gitaly note: JV: does not need to be migrated, works without a repo.
module
Gitlab
module
Gitlab
...
...
lib/gitlab/gitaly_client.rb
View file @
c858f70d
# frozen_string_literal: true
require
'base64'
require
'base64'
require
'gitaly'
require
'gitaly'
...
@@ -23,7 +25,7 @@ module Gitlab
...
@@ -23,7 +25,7 @@ module Gitlab
stacks
=
most_invoked_stack
.
join
(
'\n'
)
if
most_invoked_stack
stacks
=
most_invoked_stack
.
join
(
'\n'
)
if
most_invoked_stack
msg
=
"GitalyClient#
#{
call_site
}
called
#{
invocation_count
}
times from single request. Potential n+1?"
msg
=
"GitalyClient#
#{
call_site
}
called
#{
invocation_count
}
times from single request. Potential n+1?"
msg
<<
"
\n
The following call site called into Gitaly
#{
max_call_stack
}
times:
\n
#{
stacks
}
\n
"
if
stacks
msg
=
"
#{
msg
}
\n
The following call site called into Gitaly
#{
max_call_stack
}
times:
\n
#{
stacks
}
\n
"
if
stacks
super
(
msg
)
super
(
msg
)
end
end
...
...
lib/gitlab/github_import.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
GithubImport
module
GithubImport
def
self
.
refmap
def
self
.
refmap
...
...
lib/gitlab/gl_id.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
GlId
module
GlId
def
self
.
gl_id
(
user
)
def
self
.
gl_id
(
user
)
...
...
lib/gitlab/gl_repository.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
GlRepository
module
GlRepository
def
self
.
gl_repository
(
project
,
is_wiki
)
def
self
.
gl_repository
(
project
,
is_wiki
)
...
...
lib/gitlab/gon_helper.rb
View file @
c858f70d
# frozen_string_literal: true
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/AbcSize
module
Gitlab
module
Gitlab
...
...
lib/gitlab/gpg.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Gpg
module
Gpg
extend
self
extend
self
...
...
lib/gitlab/graphql.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Graphql
module
Graphql
StandardGraphqlError
=
Class
.
new
(
StandardError
)
StandardGraphqlError
=
Class
.
new
(
StandardError
)
...
...
lib/gitlab/group_hierarchy.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# Retrieving of parent or child groups based on a base ActiveRecord relation.
# Retrieving of parent or child groups based on a base ActiveRecord relation.
#
#
...
...
lib/gitlab/highlight.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
Highlight
class
Highlight
TIMEOUT_BACKGROUND
=
30
.
seconds
TIMEOUT_BACKGROUND
=
30
.
seconds
...
...
lib/gitlab/http.rb
View file @
c858f70d
# frozen_string_literal: true
# This class is used as a proxy for all outbounding http connection
# This class is used as a proxy for all outbounding http connection
# coming from callbacks, services and hooks. The direct use of the HTTParty
# coming from callbacks, services and hooks. The direct use of the HTTParty
# is discouraged because it can lead to several security problems, like SSRF
# is discouraged because it can lead to several security problems, like SSRF
...
...
lib/gitlab/http_io.rb
View file @
c858f70d
# frozen_string_literal: true
##
##
# This class is compatible with IO class (https://ruby-doc.org/core-2.3.1/IO.html)
# This class is compatible with IO class (https://ruby-doc.org/core-2.3.1/IO.html)
# source: https://gitlab.com/snippets/1685610
# source: https://gitlab.com/snippets/1685610
...
@@ -73,8 +75,8 @@ module Gitlab
...
@@ -73,8 +75,8 @@ module Gitlab
end
end
end
end
def
read
(
length
=
nil
,
outbuf
=
""
)
def
read
(
length
=
nil
,
outbuf
=
nil
)
out
=
""
out
=
[]
length
||=
size
-
tell
length
||=
size
-
tell
...
@@ -90,17 +92,18 @@ module Gitlab
...
@@ -90,17 +92,18 @@ module Gitlab
length
-=
chunk_data
.
bytesize
length
-=
chunk_data
.
bytesize
end
end
out
=
out
.
join
# If outbuf is passed, we put the output into the buffer. This supports IO.copy_stream functionality
# If outbuf is passed, we put the output into the buffer. This supports IO.copy_stream functionality
if
outbuf
if
outbuf
outbuf
.
slice!
(
0
,
outbuf
.
bytesize
)
outbuf
.
replace
(
out
)
outbuf
<<
out
end
end
out
out
end
end
def
readline
def
readline
out
=
""
out
=
[]
until
eof?
until
eof?
data
=
get_chunk
data
=
get_chunk
...
@@ -116,7 +119,7 @@ module Gitlab
...
@@ -116,7 +119,7 @@ module Gitlab
end
end
end
end
out
out
.
join
end
end
def
write
(
data
)
def
write
(
data
)
...
...
lib/gitlab/i18n.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
I18n
module
I18n
extend
self
extend
self
...
...
lib/gitlab/identifier.rb
View file @
c858f70d
# frozen_string_literal: true
# Detect user based on identifier like
# Detect user based on identifier like
# key-13 or user-36 or last commit
# key-13 or user-36 or last commit
module
Gitlab
module
Gitlab
...
...
lib/gitlab/import_export.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
ImportExport
module
ImportExport
extend
self
extend
self
...
...
lib/gitlab/import_formatter.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
ImportFormatter
class
ImportFormatter
def
comment
(
author
,
date
,
body
)
def
comment
(
author
,
date
,
body
)
...
...
lib/gitlab/import_sources.rb
View file @
c858f70d
# frozen_string_literal: true
# Gitlab::ImportSources module
# Gitlab::ImportSources module
#
#
# Define import sources that can be used
# Define import sources that can be used
...
...
lib/gitlab/incoming_email.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
IncomingEmail
module
IncomingEmail
UNSUBSCRIBE_SUFFIX
=
'+unsubscribe'
.
freeze
UNSUBSCRIBE_SUFFIX
=
'+unsubscribe'
.
freeze
...
...
lib/gitlab/insecure_key_fingerprint.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
#
#
# Calculates the fingerprint of a given key without using
# Calculates the fingerprint of a given key without using
...
...
lib/gitlab/issuable_metadata.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
IssuableMetadata
module
IssuableMetadata
def
issuable_meta_data
(
issuable_collection
,
collection_type
)
def
issuable_meta_data
(
issuable_collection
,
collection_type
)
...
...
lib/gitlab/issuable_sorter.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
IssuableSorter
module
IssuableSorter
class
<<
self
class
<<
self
...
...
lib/gitlab/issuables_count_for_state.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# Class for counting and caching the number of issuables per state.
# Class for counting and caching the number of issuables per state.
class
IssuablesCountForState
class
IssuablesCountForState
...
...
lib/gitlab/issues_labels.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
IssuesLabels
class
IssuesLabels
class
<<
self
class
<<
self
...
...
lib/gitlab/job_waiter.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# JobWaiter can be used to wait for a number of Sidekiq jobs to complete.
# JobWaiter can be used to wait for a number of Sidekiq jobs to complete.
#
#
...
...
lib/gitlab/json_logger.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
JsonLogger
<
::
Gitlab
::
Logger
class
JsonLogger
<
::
Gitlab
::
Logger
def
self
.
file_name_noext
def
self
.
file_name_noext
...
...
lib/gitlab/kubernetes.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# Helper methods to do with Kubernetes network services & resources
# Helper methods to do with Kubernetes network services & resources
module
Kubernetes
module
Kubernetes
...
...
lib/gitlab/language_detection.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
LanguageDetection
class
LanguageDetection
MAX_LANGUAGES
=
5
MAX_LANGUAGES
=
5
...
...
lib/gitlab/lazy.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# A class that can be wrapped around an expensive method call so it's only
# A class that can be wrapped around an expensive method call so it's only
# executed when actually needed.
# executed when actually needed.
...
...
lib/gitlab/lfs_token.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
LfsToken
class
LfsToken
attr_accessor
:actor
attr_accessor
:actor
...
...
lib/gitlab/logger.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
Logger
<
::
Logger
class
Logger
<
::
Logger
def
self
.
file_name
def
self
.
file_name
...
...
lib/gitlab/mail_room.rb
View file @
c858f70d
# frozen_string_literal: true
require
'yaml'
require
'yaml'
require
'json'
require
'json'
require_relative
'redis/queues'
unless
defined?
(
Gitlab
::
Redis
::
Queues
)
require_relative
'redis/queues'
unless
defined?
(
Gitlab
::
Redis
::
Queues
)
...
...
lib/gitlab/markup_helper.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
MarkupHelper
module
MarkupHelper
extend
self
extend
self
...
...
lib/gitlab/metrics.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Metrics
module
Metrics
include
Gitlab
::
Metrics
::
InfluxDb
include
Gitlab
::
Metrics
::
InfluxDb
...
...
lib/gitlab/multi_collection_paginator.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
MultiCollectionPaginator
class
MultiCollectionPaginator
attr_reader
:first_collection
,
:second_collection
,
:per_page
attr_reader
:first_collection
,
:second_collection
,
:per_page
...
...
lib/gitlab/omniauth_initializer.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
OmniauthInitializer
class
OmniauthInitializer
def
initialize
(
devise_config
)
def
initialize
(
devise_config
)
...
...
lib/gitlab/optimistic_locking.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
OptimisticLocking
module
OptimisticLocking
module_function
module_function
...
...
lib/gitlab/other_markup.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# Parser/renderer for markups without other special support code.
# Parser/renderer for markups without other special support code.
module
OtherMarkup
module
OtherMarkup
...
...
lib/gitlab/otp_key_rotator.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# The +otp_key_base+ param is used to encrypt the User#otp_secret attribute.
# The +otp_key_base+ param is used to encrypt the User#otp_secret attribute.
#
#
...
...
lib/gitlab/pages.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Pages
module
Pages
VERSION
=
File
.
read
(
Rails
.
root
.
join
(
"GITLAB_PAGES_VERSION"
)).
strip
.
freeze
VERSION
=
File
.
read
(
Rails
.
root
.
join
(
"GITLAB_PAGES_VERSION"
)).
strip
.
freeze
...
...
lib/gitlab/pages_client.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
PagesClient
class
PagesClient
class
<<
self
class
<<
self
...
...
lib/gitlab/pages_transfer.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
PagesTransfer
<
ProjectTransfer
class
PagesTransfer
<
ProjectTransfer
def
root_dir
def
root_dir
...
...
lib/gitlab/path_regex.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
PathRegex
module
PathRegex
extend
self
extend
self
...
...
lib/gitlab/performance_bar.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
PerformanceBar
module
PerformanceBar
ALLOWED_USER_IDS_KEY
=
'performance_bar_allowed_user_ids:v2'
.
freeze
ALLOWED_USER_IDS_KEY
=
'performance_bar_allowed_user_ids:v2'
.
freeze
...
...
lib/gitlab/plugin.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Plugin
module
Plugin
def
self
.
files
def
self
.
files
...
...
lib/gitlab/plugin_logger.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
PluginLogger
<
Gitlab
::
Logger
class
PluginLogger
<
Gitlab
::
Logger
def
self
.
file_name_noext
def
self
.
file_name_noext
...
...
lib/gitlab/polling_interval.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
PollingInterval
class
PollingInterval
HEADER_NAME
=
'Poll-Interval'
.
freeze
HEADER_NAME
=
'Poll-Interval'
.
freeze
...
...
lib/gitlab/popen.rb
View file @
c858f70d
# frozen_string_literal: true
require
'fileutils'
require
'fileutils'
require
'open3'
require
'open3'
...
@@ -11,7 +13,7 @@ module Gitlab
...
@@ -11,7 +13,7 @@ module Gitlab
def
popen
(
cmd
,
path
=
nil
,
vars
=
{},
&
block
)
def
popen
(
cmd
,
path
=
nil
,
vars
=
{},
&
block
)
result
=
popen_with_detail
(
cmd
,
path
,
vars
,
&
block
)
result
=
popen_with_detail
(
cmd
,
path
,
vars
,
&
block
)
[
result
.
stdout
<<
result
.
stderr
,
result
.
status
&
.
exitstatus
]
[
"
#{
result
.
stdout
}#{
result
.
stderr
}
"
,
result
.
status
&
.
exitstatus
]
end
end
# Returns Result
# Returns Result
...
...
lib/gitlab/profiler.rb
View file @
c858f70d
# coding: utf-8
# coding: utf-8
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Profiler
module
Profiler
FILTERED_STRING
=
'[FILTERED]'
.
freeze
FILTERED_STRING
=
'[FILTERED]'
.
freeze
...
...
lib/gitlab/project_search_results.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
ProjectSearchResults
<
SearchResults
class
ProjectSearchResults
<
SearchResults
attr_reader
:project
,
:repository_ref
attr_reader
:project
,
:repository_ref
...
@@ -57,7 +59,8 @@ module Gitlab
...
@@ -57,7 +59,8 @@ module Gitlab
ref
=
nil
ref
=
nil
filename
=
nil
filename
=
nil
basename
=
nil
basename
=
nil
data
=
""
data
=
[]
startline
=
0
startline
=
0
result
.
each_line
.
each_with_index
do
|
line
,
index
|
result
.
each_line
.
each_with_index
do
|
line
,
index
|
...
@@ -78,7 +81,7 @@ module Gitlab
...
@@ -78,7 +81,7 @@ module Gitlab
basename:
basename
,
basename:
basename
,
ref:
ref
,
ref:
ref
,
startline:
startline
,
startline:
startline
,
data:
data
,
data:
data
.
join
,
project_id:
project
?
project
.
id
:
nil
project_id:
project
?
project
.
id
:
nil
)
)
end
end
...
...
lib/gitlab/project_service_logger.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
ProjectServiceLogger
<
Gitlab
::
JsonLogger
class
ProjectServiceLogger
<
Gitlab
::
JsonLogger
def
self
.
file_name_noext
def
self
.
file_name_noext
...
...
lib/gitlab/project_template.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
ProjectTemplate
class
ProjectTemplate
attr_reader
:title
,
:name
,
:description
,
:preview
attr_reader
:title
,
:name
,
:description
,
:preview
...
...
lib/gitlab/project_transfer.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# This class is used to move local, unhashed files owned by projects to their new location
# This class is used to move local, unhashed files owned by projects to their new location
class
ProjectTransfer
class
ProjectTransfer
...
...
lib/gitlab/prometheus_client.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# Helper methods to interact with Prometheus network services & resources
# Helper methods to interact with Prometheus network services & resources
class
PrometheusClient
class
PrometheusClient
...
...
lib/gitlab/protocol_access.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
ProtocolAccess
module
ProtocolAccess
def
self
.
allowed?
(
protocol
)
def
self
.
allowed?
(
protocol
)
...
...
lib/gitlab/proxy_http_connection_adapter.rb
View file @
c858f70d
# frozen_string_literal: true
# This class is part of the Gitlab::HTTP wrapper. Depending on the value
# This class is part of the Gitlab::HTTP wrapper. Depending on the value
# of the global setting allow_local_requests_from_hooks_and_services this adapter
# of the global setting allow_local_requests_from_hooks_and_services this adapter
# will allow/block connection to internal IPs and/or urls.
# will allow/block connection to internal IPs and/or urls.
...
...
lib/gitlab/query_limiting.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
QueryLimiting
module
QueryLimiting
# Returns true if we should enable tracking of query counts.
# Returns true if we should enable tracking of query counts.
...
...
lib/gitlab/recaptcha.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Recaptcha
module
Recaptcha
def
self
.
load_configurations!
def
self
.
load_configurations!
...
...
lib/gitlab/reference_counter.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
ReferenceCounter
class
ReferenceCounter
REFERENCE_EXPIRE_TIME
=
600
REFERENCE_EXPIRE_TIME
=
600
...
...
lib/gitlab/reference_extractor.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# Extract possible GFM references from an arbitrary String for further processing.
# Extract possible GFM references from an arbitrary String for further processing.
class
ReferenceExtractor
<
Banzai
::
ReferenceExtractor
class
ReferenceExtractor
<
Banzai
::
ReferenceExtractor
...
...
lib/gitlab/regex.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Regex
module
Regex
extend
self
extend
self
...
...
lib/gitlab/repo_path.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
RepoPath
module
RepoPath
NotFoundError
=
Class
.
new
(
StandardError
)
NotFoundError
=
Class
.
new
(
StandardError
)
...
...
lib/gitlab/repository_cache.rb
View file @
c858f70d
# frozen_string_literal: true
# Interface to the Redis-backed cache store
# Interface to the Redis-backed cache store
module
Gitlab
module
Gitlab
class
RepositoryCache
class
RepositoryCache
...
@@ -6,7 +8,7 @@ module Gitlab
...
@@ -6,7 +8,7 @@ module Gitlab
def
initialize
(
repository
,
extra_namespace:
nil
,
backend:
Rails
.
cache
)
def
initialize
(
repository
,
extra_namespace:
nil
,
backend:
Rails
.
cache
)
@repository
=
repository
@repository
=
repository
@namespace
=
"
#{
repository
.
full_path
}
:
#{
repository
.
project
.
id
}
"
@namespace
=
"
#{
repository
.
full_path
}
:
#{
repository
.
project
.
id
}
"
@namespace
+=
"
:
#{
extra_namespace
}
"
if
extra_namespace
@namespace
=
"
#{
@namespace
}
:
#{
extra_namespace
}
"
if
extra_namespace
@backend
=
backend
@backend
=
backend
end
end
...
...
lib/gitlab/repository_cache_adapter.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
RepositoryCacheAdapter
module
RepositoryCacheAdapter
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
...
...
lib/gitlab/repository_check_logger.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
RepositoryCheckLogger
<
Gitlab
::
Logger
class
RepositoryCheckLogger
<
Gitlab
::
Logger
def
self
.
file_name_noext
def
self
.
file_name_noext
...
...
lib/gitlab/request_context.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
RequestContext
class
RequestContext
class
<<
self
class
<<
self
...
...
lib/gitlab/request_forgery_protection.rb
View file @
c858f70d
# frozen_string_literal: true
# A module to check CSRF tokens in requests.
# A module to check CSRF tokens in requests.
# It's used in API helpers and OmniAuth.
# It's used in API helpers and OmniAuth.
# Usage: GitLab::RequestForgeryProtection.call(env)
# Usage: GitLab::RequestForgeryProtection.call(env)
...
...
lib/gitlab/request_profiler.rb
View file @
c858f70d
# frozen_string_literal: true
require
'fileutils'
require
'fileutils'
module
Gitlab
module
Gitlab
...
...
lib/gitlab/route_map.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
RouteMap
class
RouteMap
FormatError
=
Class
.
new
(
StandardError
)
FormatError
=
Class
.
new
(
StandardError
)
...
...
lib/gitlab/routing.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Routing
module
Routing
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
...
@@ -47,7 +49,7 @@ module Gitlab
...
@@ -47,7 +49,7 @@ module Gitlab
#
#
# `request.fullpath` includes the querystring
# `request.fullpath` includes the querystring
new_path
=
request
.
path
.
sub
(
%r{/
#{
path
}
(/*)(?!.*
#{
path
}
)}
,
"/-/
#{
path
}
\\
1"
)
new_path
=
request
.
path
.
sub
(
%r{/
#{
path
}
(/*)(?!.*
#{
path
}
)}
,
"/-/
#{
path
}
\\
1"
)
new_path
<<
"
?
#{
request
.
query_string
}
"
if
request
.
query_string
.
present?
new_path
=
"
#{
new_path
}
?
#{
request
.
query_string
}
"
if
request
.
query_string
.
present?
new_path
new_path
end
end
...
...
lib/gitlab/search_results.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
SearchResults
class
SearchResults
class
FoundBlob
class
FoundBlob
...
...
lib/gitlab/seeder.rb
View file @
c858f70d
# frozen_string_literal: true
# :nocov:
# :nocov:
module
DeliverNever
module
DeliverNever
def
deliver_later
def
deliver_later
...
...
lib/gitlab/sentry.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Sentry
module
Sentry
def
self
.
enabled?
def
self
.
enabled?
...
...
lib/gitlab/setup_helper.rb
View file @
c858f70d
# frozen_string_literal: true
require
'toml-rb'
require
'toml-rb'
module
Gitlab
module
Gitlab
...
...
lib/gitlab/shard_health_cache.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
ShardHealthCache
class
ShardHealthCache
HEALTHY_SHARDS_KEY
=
'gitlab-healthy-shards'
.
freeze
HEALTHY_SHARDS_KEY
=
'gitlab-healthy-shards'
.
freeze
...
...
lib/gitlab/shell.rb
View file @
c858f70d
# frozen_string_literal: true
# Gitaly note: SSH key operations are not part of Gitaly so will never be migrated.
# Gitaly note: SSH key operations are not part of Gitaly so will never be migrated.
require
'securerandom'
require
'securerandom'
...
...
lib/gitlab/shell_adapter.rb
View file @
c858f70d
# frozen_string_literal: true
# == GitLab Shell mixin
# == GitLab Shell mixin
#
#
# Provide a shortcut to Gitlab::Shell instance by gitlab_shell
# Provide a shortcut to Gitlab::Shell instance by gitlab_shell
...
...
lib/gitlab/sherlock.rb
View file @
c858f70d
# frozen_string_literal: true
require
'securerandom'
require
'securerandom'
module
Gitlab
module
Gitlab
...
...
lib/gitlab/sidekiq_config.rb
View file @
c858f70d
# frozen_string_literal: true
require
'yaml'
require
'yaml'
require
'set'
require
'set'
...
...
lib/gitlab/sidekiq_logger.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
SidekiqLogger
<
Gitlab
::
Logger
class
SidekiqLogger
<
Gitlab
::
Logger
def
self
.
file_name_noext
def
self
.
file_name_noext
...
...
lib/gitlab/sidekiq_status.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# The SidekiqStatus module and its child classes can be used for checking if a
# The SidekiqStatus module and its child classes can be used for checking if a
# Sidekiq job has been processed or not.
# Sidekiq job has been processed or not.
...
...
lib/gitlab/sidekiq_versioning.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
SidekiqVersioning
module
SidekiqVersioning
def
self
.
install!
def
self
.
install!
...
...
lib/gitlab/snippet_search_results.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
SnippetSearchResults
<
SearchResults
class
SnippetSearchResults
<
SearchResults
include
SnippetsHelper
include
SnippetsHelper
...
...
lib/gitlab/ssh_public_key.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
SSHPublicKey
class
SSHPublicKey
Technology
=
Struct
.
new
(
:name
,
:key_class
,
:supported_sizes
)
Technology
=
Struct
.
new
(
:name
,
:key_class
,
:supported_sizes
)
...
@@ -26,7 +28,7 @@ module Gitlab
...
@@ -26,7 +28,7 @@ module Gitlab
return
key_content
if
parts
.
empty?
return
key_content
if
parts
.
empty?
parts
.
each_with_object
(
"
#{
ssh_type
}
"
).
with_index
do
|
(
part
,
content
),
index
|
parts
.
each_with_object
(
+
"
#{
ssh_type
}
"
).
with_index
do
|
(
part
,
content
),
index
|
content
<<
part
content
<<
part
if
Gitlab
::
SSHPublicKey
.
new
(
content
).
valid?
if
Gitlab
::
SSHPublicKey
.
new
(
content
).
valid?
...
...
lib/gitlab/string_placeholder_replacer.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
StringPlaceholderReplacer
class
StringPlaceholderReplacer
# This method accepts the following paras
# This method accepts the following paras
...
...
lib/gitlab/string_range_marker.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
StringRangeMarker
class
StringRangeMarker
attr_accessor
:raw_line
,
:rich_line
,
:html_escaped
attr_accessor
:raw_line
,
:rich_line
,
:html_escaped
...
...
lib/gitlab/string_regex_marker.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
StringRegexMarker
<
StringRangeMarker
class
StringRegexMarker
<
StringRangeMarker
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
...
...
lib/gitlab/task_helpers.rb
View file @
c858f70d
# frozen_string_literal: true
require
'rainbow/ext/string'
require
'rainbow/ext/string'
require
'gitlab/utils/strong_memoize'
require
'gitlab/utils/strong_memoize'
...
@@ -39,7 +41,7 @@ module Gitlab
...
@@ -39,7 +41,7 @@ module Gitlab
File
.
read
(
'/etc/os-release'
).
match
(
/PRETTY_NAME=\"(.+)\"/
)[
1
]
File
.
read
(
'/etc/os-release'
).
match
(
/PRETTY_NAME=\"(.+)\"/
)[
1
]
end
end
os_name
.
try
(
:squish
!
)
os_name
.
try
(
:squish
)
end
end
# Prompt the user to input something
# Prompt the user to input something
...
...
lib/gitlab/tcp_checker.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
TcpChecker
class
TcpChecker
attr_reader
:remote_host
,
:remote_port
,
:local_host
,
:local_port
,
:error
attr_reader
:remote_host
,
:remote_port
,
:local_host
,
:local_port
,
:error
...
...
lib/gitlab/template_helper.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
TemplateHelper
module
TemplateHelper
def
prepare_template_environment
(
file
)
def
prepare_template_environment
(
file
)
...
...
lib/gitlab/temporarily_allow.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
TemporarilyAllow
module
TemporarilyAllow
TEMPORARILY_ALLOW_MUTEX
=
Mutex
.
new
TEMPORARILY_ALLOW_MUTEX
=
Mutex
.
new
...
...
lib/gitlab/themes.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# Module containing GitLab's application theme definitions and helper methods
# Module containing GitLab's application theme definitions and helper methods
# for accessing them.
# for accessing them.
...
...
lib/gitlab/time_tracking_formatter.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
TimeTrackingFormatter
module
TimeTrackingFormatter
extend
self
extend
self
...
...
lib/gitlab/timeless.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Timeless
module
Timeless
def
self
.
timeless
(
model
,
&
block
)
def
self
.
timeless
(
model
,
&
block
)
...
...
lib/gitlab/tree_summary.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
TreeSummary
class
TreeSummary
include
::
Gitlab
::
Utils
::
StrongMemoize
include
::
Gitlab
::
Utils
::
StrongMemoize
...
...
lib/gitlab/untrusted_regexp.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
# An untrusted regular expression is any regexp containing patterns sourced
# An untrusted regular expression is any regexp containing patterns sourced
# from user input.
# from user input.
...
...
lib/gitlab/update_path_error.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
UpdatePathError
=
Class
.
new
(
StandardError
)
UpdatePathError
=
Class
.
new
(
StandardError
)
end
end
lib/gitlab/upgrader.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
Upgrader
class
Upgrader
def
execute
def
execute
...
...
lib/gitlab/uploads_transfer.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
UploadsTransfer
<
ProjectTransfer
class
UploadsTransfer
<
ProjectTransfer
def
root_dir
def
root_dir
...
...
lib/gitlab/url_blocker.rb
View file @
c858f70d
# frozen_string_literal: true
require
'resolv'
require
'resolv'
module
Gitlab
module
Gitlab
...
...
lib/gitlab/url_builder.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
UrlBuilder
class
UrlBuilder
include
Gitlab
::
Routing
include
Gitlab
::
Routing
...
...
lib/gitlab/url_sanitizer.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
UrlSanitizer
class
UrlSanitizer
ALLOWED_SCHEMES
=
%w[http https ssh git]
.
freeze
ALLOWED_SCHEMES
=
%w[http https ssh git]
.
freeze
...
...
lib/gitlab/usage_data.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
UsageData
class
UsageData
class
<<
self
class
<<
self
...
...
lib/gitlab/user_access.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
UserAccess
class
UserAccess
extend
Gitlab
::
Cache
::
RequestCache
extend
Gitlab
::
Cache
::
RequestCache
...
...
lib/gitlab/utils.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
module
Utils
module
Utils
extend
self
extend
self
...
...
lib/gitlab/version_info.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
VersionInfo
class
VersionInfo
include
Comparable
include
Comparable
...
...
lib/gitlab/visibility_level.rb
View file @
c858f70d
# frozen_string_literal: true
# Gitlab::VisibilityLevel module
# Gitlab::VisibilityLevel module
#
#
# Define allowed public modes that can be used for
# Define allowed public modes that can be used for
...
...
lib/gitlab/wiki_file_finder.rb
View file @
c858f70d
# frozen_string_literal: true
module
Gitlab
module
Gitlab
class
WikiFileFinder
<
FileFinder
class
WikiFileFinder
<
FileFinder
attr_reader
:repository
attr_reader
:repository
...
...
lib/gitlab/workhorse.rb
View file @
c858f70d
# frozen_string_literal: true
require
'base64'
require
'base64'
require
'json'
require
'json'
require
'securerandom'
require
'securerandom'
...
@@ -63,7 +65,7 @@ module Gitlab
...
@@ -63,7 +65,7 @@ module Gitlab
def
send_git_archive
(
repository
,
ref
:,
format
:,
append_sha
:)
def
send_git_archive
(
repository
,
ref
:,
format
:,
append_sha
:)
format
||=
'tar.gz'
format
||=
'tar.gz'
format
.
downcase!
format
=
format
.
downcase
params
=
repository
.
archive_metadata
(
ref
,
Gitlab
.
config
.
gitlab
.
repository_downloads_path
,
format
,
append_sha:
append_sha
)
params
=
repository
.
archive_metadata
(
ref
,
Gitlab
.
config
.
gitlab
.
repository_downloads_path
,
format
,
append_sha:
append_sha
)
raise
"Repository or ref not found"
if
params
.
empty?
raise
"Repository or ref not found"
if
params
.
empty?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment