Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-03-26 03:09:21 +00:00
parent 9190fb4bdc
commit 88a161660f
72 changed files with 162 additions and 134 deletions

View File

@ -898,11 +898,6 @@ Style/RedundantFetchBlock:
Style/RedundantFileExtensionInRequire:
Enabled: false
# Offense count: 248
# Cop supports --auto-correct.
Style/RedundantFreeze:
Enabled: false
# Offense count: 206
# Cop supports --auto-correct.
Style/RedundantInterpolation:

View File

@ -3,6 +3,8 @@ import { throttle } from 'lodash';
import { numberToHumanSize } from '~/lib/utils/number_utils';
import { encodeSaferUrl } from '~/lib/utils/url_utility';
const BLOB_PREFIX = 'blob:';
export default {
props: {
path: {
@ -45,7 +47,7 @@ export default {
return this.width && this.height;
},
safePath() {
return encodeSaferUrl(this.path);
return this.path.startsWith(BLOB_PREFIX) ? this.path : encodeSaferUrl(this.path);
},
},
beforeDestroy() {

View File

@ -3,7 +3,7 @@
module Mutations
module ContainerRepositories
class DestroyTags < ::Mutations::ContainerRepositories::DestroyBase
LIMIT = 20.freeze
LIMIT = 20
TOO_MANY_TAGS_ERROR_MESSAGE = "Number of tags is greater than #{LIMIT}"

View File

@ -4,7 +4,7 @@ module Ci
module BuildTraceChunks
class Redis
CHUNK_REDIS_TTL = 1.week
LUA_APPEND_CHUNK = <<~EOS.freeze
LUA_APPEND_CHUNK = <<~EOS
local key, new_data, offset = KEYS[1], ARGV[1], ARGV[2]
local length = new_data:len()
local expire = #{CHUNK_REDIS_TTL.seconds}

View File

@ -33,7 +33,7 @@ module CounterAttribute
extend AfterCommitQueue
include Gitlab::ExclusiveLeaseHelpers
LUA_STEAL_INCREMENT_SCRIPT = <<~EOS.freeze
LUA_STEAL_INCREMENT_SCRIPT = <<~EOS
local increment_key, flushed_key = KEYS[1], KEYS[2]
local increment_value = redis.call("get", increment_key) or 0
local flushed_value = redis.call("incrby", flushed_key, increment_value)

View File

@ -8,7 +8,7 @@ module DesignManagement
# repository is entirely GitLab-managed rather than user-facing.
#
# Enable all uploaded files to be stored in LFS.
MANAGED_GIT_ATTRIBUTES = <<~GA.freeze
MANAGED_GIT_ATTRIBUTES = <<~GA
/#{DesignManagement.designs_directory}/* filter=lfs diff=lfs merge=lfs -text
GA

View File

@ -7,8 +7,8 @@ class Packages::Dependency < ApplicationRecord
validates :name, uniqueness: { scope: :version_pattern }
NAME_VERSION_PATTERN_TUPLE_MATCHING = '(name, version_pattern) = (?, ?)'
MAX_STRING_LENGTH = 255.freeze
MAX_CHUNKED_QUERIES_COUNT = 10.freeze
MAX_STRING_LENGTH = 255
MAX_CHUNKED_QUERIES_COUNT = 10
def self.ids_for_package_names_and_version_patterns(names_and_version_patterns = {}, chunk_size = 50, max_rows_limit = 200)
names_and_version_patterns.reject! { |key, value| key.size > MAX_STRING_LENGTH || value.size > MAX_STRING_LENGTH }

View File

@ -4,7 +4,7 @@ class Packages::Tag < ApplicationRecord
validates :package, :name, presence: true
FOR_PACKAGES_TAGS_LIMIT = 200.freeze
FOR_PACKAGES_TAGS_LIMIT = 200
NUGET_TAGS_SEPARATOR = ' ' # https://docs.microsoft.com/en-us/nuget/reference/nuspec#tags
scope :preload_package, -> { preload(:package) }

View File

@ -6,7 +6,7 @@ module Packages
include Packages::Nuget::PresenterHelpers
include Gitlab::Utils::StrongMemoize
COUNT = 1.freeze
COUNT = 1
def initialize(packages)
@packages = packages

View File

@ -5,7 +5,7 @@ module Suggestible
include Gitlab::Utils::StrongMemoize
# This translates into limiting suggestion changes to `suggestion:-100+100`.
MAX_LINES_CONTEXT = 100.freeze
MAX_LINES_CONTEXT = 100
def diff_lines
strong_memoize(:diff_lines) do

View File

@ -2,7 +2,7 @@
module MergeRequests
class MigrateExternalDiffsService < ::BaseService
MAX_JOBS = 1000.freeze
MAX_JOBS = 1000
attr_reader :diff

View File

@ -2,7 +2,7 @@
module PodLogs
class KubernetesService < PodLogs::BaseService
LOGS_LIMIT = 500.freeze
LOGS_LIMIT = 500
REPLACEMENT_CHAR = "\u{FFFD}"
EncodingHelperError = Class.new(StandardError)

View File

@ -2,7 +2,7 @@
module Users
class BatchStatusCleanerService
BATCH_SIZE = 100.freeze
BATCH_SIZE = 100
# Cleanup BATCH_SIZE user_statuses records
# rubocop: disable CodeReuse/ActiveRecord

View File

@ -9,7 +9,7 @@ class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWo
InvalidPolicyError = Class.new(StandardError)
BATCH_SIZE = 1000.freeze
BATCH_SIZE = 1000
def perform
throttling_enabled? ? perform_throttled : perform_unthrottled

View File

@ -0,0 +1,5 @@
---
title: Enable RedundantFreeze Cop and Remove Remaining Offenses
merge_request: 57288
author: Lee Tickett @leetickett
type: other

View File

@ -0,0 +1,5 @@
---
title: Fixed rendering of the image blobs
merge_request: 57479
author:
type: fixed

View File

@ -7,12 +7,12 @@ NO_SPECS_LABELS = [
'documentation',
'QA'
].freeze
NO_NEW_SPEC_MESSAGE = <<~MSG.freeze
NO_NEW_SPEC_MESSAGE = <<~MSG
You've made some app changes, but didn't add any tests.
That's OK as long as you're refactoring existing code,
but please consider adding any of the %<labels>s labels.
MSG
EE_CHANGE_WITH_FOSS_SPEC_CHANGE_MESSAGE = <<~MSG.freeze
EE_CHANGE_WITH_FOSS_SPEC_CHANGE_MESSAGE = <<~MSG
You've made some EE-specific changes, but only made changes to FOSS tests.
This could be a sign that you're testing an EE-specific behavior in a FOSS test.
@ -24,7 +24,7 @@ Please make sure the spec files pass in AS-IF-FOSS mode either:
MSG
CONTROLLER_SPEC_DEPRECATION_MESSAGE = <<~MSG.freeze
CONTROLLER_SPEC_DEPRECATION_MESSAGE = <<~MSG
Do not add new controller specs. We are moving from controller specs to
request specs (and/or feature specs). Please add request specs under
`/spec/requests` and/or `/ee/spec/requests` instead.

View File

@ -4,8 +4,8 @@ class RemoveTerraformStateVerificationIndexes < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial".freeze
FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial".freeze
CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial"
FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial"
disable_ddl_transaction!

View File

@ -4,10 +4,10 @@ class AddHasExternalWikiTrigger < ActiveRecord::Migration[6.0]
include Gitlab::Database::SchemaHelpers
DOWNTIME = false
FUNCTION_NAME = 'set_has_external_wiki'.freeze
TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert'.freeze
TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update'.freeze
TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete'.freeze
FUNCTION_NAME = 'set_has_external_wiki'
TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert'
TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update'
TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete'
def up
create_trigger_function(FUNCTION_NAME, replace: true) do

View File

@ -7,7 +7,7 @@ class DropTemporaryIndexOnCiBuilds < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
INDEX = 'tmp_build_stage_position_index'.freeze
INDEX = 'tmp_build_stage_position_index'
def up
remove_concurrent_index_by_name :ci_builds, INDEX

View File

@ -19,8 +19,8 @@ class ScheduleSyncIssuablesStateId < ActiveRecord::Migration[5.0]
#
BATCH_SIZE = 5000
DELAY_INTERVAL = 120.seconds.to_i
ISSUES_MIGRATION = 'SyncIssuesStateId'.freeze
MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId'.freeze
ISSUES_MIGRATION = 'SyncIssuesStateId'
MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId'
disable_ddl_transaction!

View File

@ -5,7 +5,7 @@ class ScheduleBackfillPushRulesIdInProjects < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
MIGRATION = 'BackfillPushRulesIdInProjects'.freeze
MIGRATION = 'BackfillPushRulesIdInProjects'
BATCH_SIZE = 1_000
class PushRules < ActiveRecord::Base

View File

@ -7,7 +7,7 @@ class MigrateVulnerabilityDismissals < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
MIGRATION = 'UpdateVulnerabilitiesToDismissed'.freeze
MIGRATION = 'UpdateVulnerabilitiesToDismissed'
BATCH_SIZE = 500
DELAY_INTERVAL = 2.minutes.to_i

View File

@ -3,7 +3,7 @@
class SetJobWaiterTtl < ActiveRecord::Migration[6.0]
DOWNTIME = false
SCRIPT = <<~LUA.freeze
SCRIPT = <<~LUA
if redis.call("ttl", KEYS[1]) < 0 then
redis.call("expire", KEYS[1], 21600)
end

View File

@ -7,7 +7,7 @@ class ScheduleSyncBlockingIssuesCount < ActiveRecord::Migration[6.0]
BATCH_SIZE = 50
DELAY_INTERVAL = 120.seconds.to_i
MIGRATION = 'SyncBlockingIssuesCount'.freeze
MIGRATION = 'SyncBlockingIssuesCount'
disable_ddl_transaction!

View File

@ -5,7 +5,7 @@ class ScheduleBackfillingArtifactExpiryMigration < ActiveRecord::Migration[6.0]
DOWNTIME = false
SWITCH_DATE = Time.utc(2020, 6, 22).freeze
INDEX_NAME = 'expired_artifacts_temp_index'.freeze
INDEX_NAME = 'expired_artifacts_temp_index'
INDEX_CONDITION = "expire_at IS NULL AND created_at < '#{SWITCH_DATE}'"
disable_ddl_transaction!

View File

@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalWikiData < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
TMP_INDEX_NAME = 'tmp_index_projects_on_id_where_has_external_wiki_is_true'.freeze
TMP_INDEX_NAME = 'tmp_index_projects_on_id_where_has_external_wiki_is_true'
BATCH_SIZE = 100
disable_ddl_transaction!

View File

@ -4,11 +4,11 @@ class ScheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
MIGRATION = 'BackfillArtifactExpiryDate'.freeze
MIGRATION = 'BackfillArtifactExpiryDate'
SWITCH_DATE = Date.new(2020, 06, 22).freeze
INDEX_NAME = 'expired_artifacts_temp_index'.freeze
INDEX_NAME = 'expired_artifacts_temp_index'
OLD_INDEX_CONDITION = "expire_at IS NULL AND created_at < '#{SWITCH_DATE}'"
INDEX_CONDITION = "expire_at IS NULL AND date(created_at AT TIME ZONE 'UTC') < '2020-06-22'::date".freeze
INDEX_CONDITION = "expire_at IS NULL AND date(created_at AT TIME ZONE 'UTC') < '2020-06-22'::date"
disable_ddl_transaction!

View File

@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalIssueTrackerData < ActiveRecord::Migratio
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
TMP_INDEX_NAME = 'tmp_idx_projects_on_id_where_has_external_issue_tracker_is_true'.freeze
TMP_INDEX_NAME = 'tmp_idx_projects_on_id_where_has_external_issue_tracker_is_true'
BATCH_SIZE = 100
disable_ddl_transaction!

View File

@ -4,7 +4,7 @@ class RescheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
MIGRATION = 'BackfillArtifactExpiryDate'.freeze
MIGRATION = 'BackfillArtifactExpiryDate'
SWITCH_DATE = Date.new(2020, 06, 22).freeze
disable_ddl_transaction!

View File

@ -19,7 +19,7 @@ Wikis use Git repositories as storage backend, and can be accessed through:
- The [Web UI](../user/project/wiki/index.md)
- The [REST API](../api/wikis.md)
- [Git itself](../user/project/wiki/#adding-and-editing-wiki-pages-locally)
- [Git itself](../user/project/wiki/index.md#create-or-edit-wiki-pages-locally)
[Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2214) in GitLab 13.5, wikis are also available
for groups, in addition to projects.

View File

@ -50,7 +50,7 @@ Projects can be backed up in their entirety by exporting them either [through th
With exports, be sure to take note of [what is and is not](../project/settings/import_export.md#exported-contents), included in a project export.
Since GitLab is built on Git, you can back up **just** the repository of a project by [cloning](../../gitlab-basics/start-using-git.md#clone-a-repository) it to another machine. Similarly, if you need to back up just the wiki of a repository it can also be cloned and all files uploaded to that wiki are included [if they were uploaded after 2020-08-22](../project/wiki/index.md#creating-a-new-wiki-page).
Since GitLab is built on Git, you can back up **just** the repository of a project by [cloning](../../gitlab-basics/start-using-git.md#clone-a-repository) it to another machine. Similarly, if you need to back up just the wiki of a repository it can also be cloned and all files uploaded to that wiki are included [if they were uploaded after 2020-08-22](../project/wiki/index.md#create-a-new-wiki-page).
## Alternative SSH port

View File

@ -16,13 +16,13 @@ repository, but you do want to keep it in the same project where your code
resides.
You can create Wiki pages in the web interface or
[locally using Git](#adding-and-editing-wiki-pages-locally) since every Wiki is
[locally using Git](#create-or-edit-wiki-pages-locally) since every Wiki is
a separate Git repository.
[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13195) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.5,
**group wikis** became available. Their usage is similar to project wikis, with a few [limitations](../../group/index.md#group-wikis).
## First time creating the Home page
## Create the wiki home page
The first time you visit a Wiki, you are directed to create the Home page.
The Home page is necessary to be created because it serves as the landing page
@ -32,7 +32,7 @@ message.
![New home page](img/wiki_create_home_page.png)
## Creating a new wiki page
## Create a new wiki page
NOTE:
Requires Developer [permissions](../../permissions.md).
@ -60,7 +60,7 @@ When you're ready, select **Create page** and the new page is created.
![New page](img/wiki_create_new_page.png)
### Attachment storage
### Store attachments for wiki pages
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/33475) in GitLab 11.3.
@ -94,7 +94,7 @@ Please note that:
- Non-ASCII characters take up more than one byte.
- It's still possible to create files and directories exceeding those limits locally through Git, but this might break on other people's machines.
## Editing a wiki page
## Edit a wiki page
You need Developer [permissions](../../permissions.md) or higher to edit a wiki page.
To do so:
@ -103,12 +103,12 @@ To do so:
1. Edit the content.
1. Select **Save changes**.
### Adding a table of contents
### Create a table of contents
To generate a table of contents from the headings in a Wiki page, use the `[[_TOC_]]` tag.
For an example, see [Table of contents](../../markdown.md#table-of-contents).
## Deleting a wiki page
## Delete a wiki page
You need Maintainer [permissions](../../permissions.md) or higher to delete a wiki page.
To do so:
@ -117,7 +117,7 @@ To do so:
1. Select **Delete page**.
1. Confirm the deletion.
## Moving a wiki page
## Move a wiki page
You need Developer [permissions](../../permissions.md) or higher to move a wiki page.
To do so:
@ -139,7 +139,7 @@ If you want to do the opposite:
1. Change the **Title** from `about` to `company/about`.
1. Select **Save changes**.
## Viewing a list of all created wiki pages
## View list of all wiki pages
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/17673/) in GitLab 13.5, wiki pages are displayed as a nested tree in the sidebar and pages overview.
@ -151,7 +151,7 @@ found. The list is ordered alphabetically.
If you have many pages, not all are listed in the sidebar. Select
**View All Pages** to see all of them.
## Viewing the history of a wiki page
## View history of a wiki page
The changes of a wiki page over time are recorded in the wiki's Git repository,
and you can view them by selecting **Page history**.
@ -163,7 +163,7 @@ number in the **Page version** column.
![Wiki page history](img/wiki_page_history.png)
### Viewing the changes between page versions
### View changes between page versions
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15242) in GitLab 13.2.
@ -175,7 +175,7 @@ Similar to versioned diff file views, you can see the changes made in a given Wi
![Wiki page changes](img/wiki_page_diffs_v13_2.png)
## Wiki activity records
## Track wiki events
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14902) in **GitLab 12.10.**
> - Git events were [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216014) in **GitLab 13.0.**
@ -186,7 +186,7 @@ displayed on the [user profile](../../profile/index.md#access-your-user-profile)
[group](../../group/index.md#view-group-activity),
and [project](../working_with_projects.md#project-activity) activity pages.
## Adding and editing wiki pages locally
## Create or edit wiki pages locally
Since wikis are based on Git repositories, you can clone them locally and edit
them like you would do with every other Git repository.
@ -202,7 +202,7 @@ otherwise they don't display when pushed to GitLab:
- AsciiDoc extensions: `.adoc`, `.ad`, `.asciidoc`.
- Other markup extensions: `.textile`, `.rdoc`, `.org`, `.creole`, `.wiki`, `.mediawiki`, `.rst`.
## Customizing sidebar
## Customize sidebar
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/23109) in GitLab 13.8, the sidebar can be customized by selecting the **Edit sidebar** button.
@ -225,3 +225,7 @@ Example for `_sidebar` (using Markdown format):
```
Support for displaying a generated table of contents with a custom side navigation is planned.
## Resources
- [Group wikis](../../group/index.md#group-wikis)

View File

@ -5,7 +5,7 @@ group: Utilization
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Storage usage quota
# Storage usage quota **(FREE SAAS)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/13294) in GitLab 12.0.
> - Moved to GitLab Free.

View File

@ -43,7 +43,7 @@ module Banzai
TEXT_QUERY = %Q(descendant-or-self::text()[
not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')})
and contains(., '://')
]).freeze
])
PUNCTUATION_PAIRS = {
"'" => "'",

View File

@ -42,7 +42,7 @@ module Banzai
TEXT_QUERY = %Q(descendant-or-self::text()[
not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')})
and contains(., ']\(')
]).freeze
])
def call
doc.xpath(TEXT_QUERY).each do |node|

View File

@ -4,8 +4,8 @@ module BulkImports
module Clients
class Http
API_VERSION = 'v4'
DEFAULT_PAGE = 1.freeze
DEFAULT_PER_PAGE = 30.freeze
DEFAULT_PAGE = 1
DEFAULT_PER_PAGE = 30
ConnectionError = Class.new(StandardError)

View File

@ -5,7 +5,7 @@ module Gitlab
module Ldap
class Adapter
SEARCH_RETRY_FACTOR = [1, 1, 2, 3].freeze
MAX_SEARCH_RETRIES = Rails.env.test? ? 1 : SEARCH_RETRY_FACTOR.size.freeze
MAX_SEARCH_RETRIES = Rails.env.test? ? 1 : SEARCH_RETRY_FACTOR.size
attr_reader :provider, :ldap

View File

@ -4,7 +4,7 @@ module Gitlab
module Auth
module Saml
class OriginValidator
AUTH_REQUEST_SESSION_KEY = "last_authn_request_id".freeze
AUTH_REQUEST_SESSION_KEY = "last_authn_request_id"
def initialize(session)
@session = session || {}

View File

@ -32,7 +32,7 @@ class Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid
}.freeze
NAMESPACE_REGEX = /(\h{8})-(\h{4})-(\h{4})-(\h{4})-(\h{4})(\h{8})/.freeze
PACK_PATTERN = "NnnnnN".freeze
PACK_PATTERN = "NnnnnN"
def self.call(value)
Digest::UUID.uuid_v5(namespace_id, value)

View File

@ -14,7 +14,7 @@ module Gitlab
METRICS_SHARD_TAG_PREFIX = 'metrics_shard::'
DEFAULT_METRICS_SHARD = 'default'
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET = 5.freeze
JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET = 5
OPERATION_COUNTERS = [
:build_can_pick,

View File

@ -5,7 +5,7 @@ module Gitlab
module BackgroundMigration
class BatchedMigration < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
JOB_CLASS_MODULE = 'Gitlab::BackgroundMigration'
BATCH_CLASS_MODULE = "#{JOB_CLASS_MODULE}::BatchingStrategies".freeze
BATCH_CLASS_MODULE = "#{JOB_CLASS_MODULE}::BatchingStrategies"
self.table_name = :batched_background_migrations

View File

@ -10,7 +10,7 @@ module Gitlab
# Adds a "magic" comment in the generated SQL expression in order to be able to tell if we're sorting by similarity.
# Example: /* gitlab/database/similarity_score */ SIMILARITY(COALESCE...
SIMILARITY_FUNCTION_CALL_WITH_ANNOTATION = "/* #{DISPLAY_NAME} */ SIMILARITY".freeze
SIMILARITY_FUNCTION_CALL_WITH_ANNOTATION = "/* #{DISPLAY_NAME} */ SIMILARITY"
# This method returns an Arel expression that can be used in an ActiveRecord query to order the resultset by similarity.
#

View File

@ -15,14 +15,14 @@ module Gitlab
PREFIX = 'gitlab:exclusive_lease'
NoKey = Class.new(ArgumentError)
LUA_CANCEL_SCRIPT = <<~EOS.freeze
LUA_CANCEL_SCRIPT = <<~EOS
local key, uuid = KEYS[1], ARGV[1]
if redis.call("get", key) == uuid then
redis.call("del", key)
end
EOS
LUA_RENEW_SCRIPT = <<~EOS.freeze
LUA_RENEW_SCRIPT = <<~EOS
local key, uuid, ttl = KEYS[1], ARGV[1], ARGV[2]
if redis.call("get", key) == uuid then
redis.call("expire", key, ttl)

View File

@ -11,7 +11,7 @@ module Gitlab
DirectPathAccessError = Class.new(StandardError)
InvalidConfigurationError = Class.new(StandardError)
INVALID_STORAGE_MESSAGE = <<~MSG.freeze
INVALID_STORAGE_MESSAGE = <<~MSG
Storage is invalid because it has no `path` key.
For source installations, update your config/gitlab.yml Refer to gitlab.yml.example for an updated example.

View File

@ -7,7 +7,7 @@ module Gitlab
extend self
def local_module_prefix
@gitlab_prefix ||= "#{Settings.build_gitlab_go_url}/".freeze
@gitlab_prefix ||= "#{Settings.build_gitlab_go_url}/"
end
def semver_tag?(tag)

View File

@ -6,7 +6,7 @@ module Gitlab
class RelationFactory
include Gitlab::Utils::StrongMemoize
IMPORTED_OBJECT_MAX_RETRIES = 5.freeze
IMPORTED_OBJECT_MAX_RETRIES = 5
OVERRIDES = {}.freeze
EXISTING_OBJECT_RELATIONS = %i[].freeze

View File

@ -31,7 +31,7 @@ module Gitlab
RACK_ENV_KEY = 'HTTP_GITLAB_WORKHORSE_MULTIPART_FIELDS'
JWT_PARAM_SUFFIX = '.gitlab-workhorse-upload'
JWT_PARAM_FIXED_KEY = 'upload'
REWRITTEN_FIELD_NAME_MAX_LENGTH = 10000.freeze
REWRITTEN_FIELD_NAME_MAX_LENGTH = 10000
class Handler
def initialize(env, message)

View File

@ -17,7 +17,7 @@
module Gitlab
module Middleware
class SameSiteCookies
COOKIE_SEPARATOR = "\n".freeze
COOKIE_SEPARATOR = "\n"
def initialize(app)
@app = app

View File

@ -4,7 +4,7 @@ module Gitlab
module Prometheus
module Queries
class MatchedMetricQuery < BaseQuery
MAX_QUERY_ITEMS = 40.freeze
MAX_QUERY_ITEMS = 40
def query
groups_data.map do |group, data|

View File

@ -11,7 +11,7 @@ module Gitlab
UUID_V5_PATTERN = /\h{8}-\h{4}-5\h{3}-\h{4}-\h{4}\h{8}/.freeze
NAMESPACE_REGEX = /(\h{8})-(\h{4})-(\h{4})-(\h{4})-(\h{4})(\h{8})/.freeze
PACK_PATTERN = "NnnnnN".freeze
PACK_PATTERN = "NnnnnN"
class << self
def v5(name, namespace_id: default_namespace_id)

View File

@ -3,7 +3,7 @@
namespace :cache do
namespace :clear do
REDIS_CLEAR_BATCH_SIZE = 1000 # There seems to be no speedup when pushing beyond 1,000
REDIS_SCAN_START_STOP = '0'.freeze # Magic value, see http://redis.io/commands/scan
REDIS_SCAN_START_STOP = '0' # Magic value, see http://redis.io/commands/scan
desc "GitLab | Cache | Clear redis cache"
task redis: :environment do

View File

@ -6491,6 +6491,9 @@ msgstr ""
msgid "ClusterAgents|Integrate with the GitLab Agent"
msgstr ""
msgid "ClusterAgents|Last used"
msgstr ""
msgid "ClusterAgents|Learn how to create an agent access token"
msgstr ""
@ -6500,6 +6503,9 @@ msgstr ""
msgid "ClusterAgents|Name"
msgstr ""
msgid "ClusterAgents|Never"
msgstr ""
msgid "ClusterAgents|The GitLab Agent also requires %{linkStart}enabling the Agent Server%{linkEnd}"
msgstr ""

View File

@ -5,7 +5,7 @@ module RuboCop
# Cop that blacklists keyword arguments usage in Sidekiq workers
class AvoidKeywordArgumentsInSidekiqWorkers < RuboCop::Cop::Cop
MSG = "Do not use keyword arguments in Sidekiq workers. " \
"For details, check https://github.com/mperham/sidekiq/issues/2372".freeze
"For details, check https://github.com/mperham/sidekiq/issues/2372"
OBSERVED_METHOD = :perform
def on_def(node)

View File

@ -5,7 +5,7 @@ module RuboCop
module Gitlab
class ChangeTimezone < RuboCop::Cop::Cop
MSG = "Do not change timezone in the runtime (application or rspec), " \
"it could result in silently modifying other behavior.".freeze
"it could result in silently modifying other behavior."
def_node_matcher :changing_timezone?, <<~PATTERN
(send (const nil? :Time) :zone= ...)

View File

@ -19,7 +19,7 @@ module RuboCop
class AmbiguousPageObjectName < RuboCop::Cop::Cop
include QAHelpers
MESSAGE = "Don't use 'page' as a name for a Page Object. Use `%s` instead.".freeze
MESSAGE = "Don't use 'page' as a name for a Page Object. Use `%s` instead."
def_node_matcher :ambiguous_page?, <<~PATTERN
(block

View File

@ -19,7 +19,7 @@ module RuboCop
class ElementWithPattern < RuboCop::Cop::Cop
include QAHelpers
MESSAGE = "Don't use a pattern for element, create a corresponding `%s` instead.".freeze
MESSAGE = "Don't use a pattern for element, create a corresponding `%s` instead."
def on_send(node)
return unless in_qa_file?(node)

View File

@ -17,7 +17,7 @@ module RuboCop
# stub_env('FOO', 'bar')
# end
class EnvAssignment < RuboCop::Cop::Cop
MESSAGE = "Don't assign to ENV, use `stub_env` instead.".freeze
MESSAGE = "Don't assign to ENV, use `stub_env` instead."
def_node_search :env_assignment?, <<~PATTERN
(send (const nil? :ENV) :[]= ...)

View File

@ -14,7 +14,7 @@ module RuboCop
# let(:users) { table(:users) }
# let(:user) { users.create!(name: 'User 1', username: 'user1') }
class FactoriesInMigrationSpecs < RuboCop::Cop::Cop
MESSAGE = "Don't use FactoryBot.%s in migration specs, use `table` instead.".freeze
MESSAGE = "Don't use FactoryBot.%s in migration specs, use `table` instead."
FORBIDDEN_METHODS = %i[build build_list create create_list attributes_for].freeze
def_node_search :forbidden_factory_usage?, <<~PATTERN

View File

@ -13,7 +13,7 @@ module RuboCop
# # good
# HTTParty.get(url, basic_auth: { username: 'foo' })
class HTTPartyBasicAuth < RuboCop::Cop::Cop
MESSAGE = "`basic_auth: { user: ... }` does not work - replace `user:` with `username:`".freeze
MESSAGE = "`basic_auth: { user: ... }` does not work - replace `user:` with `username:`"
RESTRICT_ON_SEND = %i(get put post delete).freeze

View File

@ -3,7 +3,7 @@
module RuboCop
module Cop
class StaticTranslationDefinition < RuboCop::Cop::Cop
MSG = "The text you're translating will be already in the translated form when it's assigned to the constant. When a users changes the locale, these texts won't be translated again. Consider moving the translation logic to a method.".freeze
MSG = "The text you're translating will be already in the translated form when it's assigned to the constant. When a users changes the locale, these texts won't be translated again. Consider moving the translation logic to a method."
TRANSLATION_METHODS = %i[_ s_ n_].freeze

View File

@ -14,7 +14,7 @@ RSpec.describe "User creates milestone", :js do
end
it "creates milestone" do
title = "v2.3".freeze
title = "v2.3"
fill_in("Title", with: title)
fill_in("Description", with: "# Description header")

View File

@ -16,7 +16,7 @@ RSpec.describe "User creates branch", :js do
end
it "creates new branch" do
branch_name = "deploy_keys".freeze
branch_name = "deploy_keys"
create_branch(branch_name)
@ -25,7 +25,7 @@ RSpec.describe "User creates branch", :js do
context "when branch name is invalid" do
it "does not create new branch" do
invalid_branch_name = "1.0 stable".freeze
invalid_branch_name = "1.0 stable"
fill_in("branch_name", with: invalid_branch_name)
page.find("body").click # defocus the branch_name input

View File

@ -19,7 +19,7 @@ RSpec.describe "User edits a comment on a commit", :js do
end
it "edits comment" do
new_comment_text = "+1 Awesome!".freeze
new_comment_text = "+1 Awesome!"
page.within(".main-notes-list") do
note = find(".note")

View File

@ -6,6 +6,8 @@ const DUMMY_IMAGE_URL = `${FIXTURES_PATH}/static/images/one_white_pixel.png`;
const GREEN_BOX_IMAGE_URL = `${FIXTURES_PATH}/static/images/green_box.png`;
const RED_BOX_IMAGE_URL = `${FIXTURES_PATH}/static/images/red_box.png`;
const DUMMY_IMAGE_BLOB_PATH = 'SpongeBlob.png';
// NOTE: module.exports is needed so that this file can be used
// by environment.js
//
@ -16,4 +18,5 @@ module.exports = {
DUMMY_IMAGE_URL,
GREEN_BOX_IMAGE_URL,
RED_BOX_IMAGE_URL,
DUMMY_IMAGE_BLOB_PATH,
};

View File

@ -1,12 +1,12 @@
import { mount } from '@vue/test-utils';
import { GREEN_BOX_IMAGE_URL } from 'spec/test_constants';
import { shallowMount } from '@vue/test-utils';
import { GREEN_BOX_IMAGE_URL, DUMMY_IMAGE_BLOB_PATH } from 'spec/test_constants';
import ImageViewer from '~/vue_shared/components/content_viewer/viewers/image_viewer.vue';
describe('Image Viewer', () => {
let wrapper;
it('renders image preview', () => {
wrapper = mount(ImageViewer, {
wrapper = shallowMount(ImageViewer, {
propsData: { path: GREEN_BOX_IMAGE_URL, fileSize: 1024 },
});
@ -22,7 +22,7 @@ describe('Image Viewer', () => {
`(
'shows file size as "$humanizedFileSize", if fileSize=$fileSize and renderInfo=$renderInfo',
({ fileSize, renderInfo, elementExists, humanizedFileSize }) => {
wrapper = mount(ImageViewer, {
wrapper = shallowMount(ImageViewer, {
propsData: { path: GREEN_BOX_IMAGE_URL, fileSize, renderInfo },
});
@ -36,11 +36,19 @@ describe('Image Viewer', () => {
describe('file path', () => {
it('should output a valid URL path for the image', () => {
wrapper = mount(ImageViewer, {
wrapper = shallowMount(ImageViewer, {
propsData: { path: '/url/hello#1.jpg' },
});
expect(wrapper.find('img').attributes('src')).toBe('/url/hello%231.jpg');
});
it('outputs path without transformations when outputting a Blob', () => {
const file = new File([], DUMMY_IMAGE_BLOB_PATH);
const path = window.URL.createObjectURL(file);
wrapper = shallowMount(ImageViewer, {
propsData: { path },
});
expect(wrapper.find('img').attributes('src')).toBe(path);
});
});
});

View File

@ -162,7 +162,7 @@ RSpec.describe Gitlab::Utils do
describe '.nlbr' do
it 'replaces new lines with <br>' do
expect(described_class.nlbr("<b>hello</b>\n<i>world</i>".freeze)).to eq("hello<br>world")
expect(described_class.nlbr("<b>hello</b>\n<i>world</i>")).to eq("hello<br>world")
end
end
@ -388,8 +388,8 @@ RSpec.describe Gitlab::Utils do
describe ".safe_downcase!" do
where(:str, :result) do
"test".freeze | "test"
"Test".freeze | "test"
"test" | "test"
"Test" | "test"
"test" | "test"
"Test" | "test"
end

View File

@ -5,8 +5,8 @@ require 'fast_spec_helper'
require_relative '../../../../rubocop/cop/rspec/env_assignment'
RSpec.describe RuboCop::Cop::RSpec::EnvAssignment do
offense_call_single_quotes_key = %(ENV['FOO'] = 'bar').freeze
offense_call_double_quotes_key = %(ENV["FOO"] = 'bar').freeze
offense_call_single_quotes_key = %(ENV['FOO'] = 'bar')
offense_call_double_quotes_key = %(ENV["FOO"] = 'bar')
let(:source_file) { 'spec/foo_spec.rb' }

View File

@ -5,7 +5,7 @@ RSpec.describe Packages::CreateDependencyService do
describe '#execute' do
let_it_be(:namespace) {create(:namespace)}
let_it_be(:version) { '1.0.1' }
let_it_be(:package_name) { "@#{namespace.path}/my-app".freeze }
let_it_be(:package_name) { "@#{namespace.path}/my-app" }
context 'when packages are published' do
let(:json_file) { 'packages/npm/payload.json' }

View File

@ -7,7 +7,7 @@
class CiArtifactMetadataGenerator
attr_accessor :entries, :output
ARTIFACT_METADATA = "GitLab Build Artifacts Metadata 0.0.2\n".freeze
ARTIFACT_METADATA = "GitLab Build Artifacts Metadata 0.0.2\n"
def initialize(stream)
@entries = {}

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module JiraServiceHelper
JIRA_URL = "http://jira.example.net".freeze
JIRA_URL = "http://jira.example.net"
JIRA_API = JIRA_URL + "/rest/api/2"
def jira_service_settings

View File

@ -31,64 +31,64 @@
module SeedRepo
module BigCommit
ID = "913c66a37b4a45b9769037c55c2d238bd0942d2e".freeze
PARENT_ID = "cfe32cf61b73a0d5e9f13e774abde7ff789b1660".freeze
MESSAGE = "Files, encoding and much more".freeze
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze
ID = "913c66a37b4a45b9769037c55c2d238bd0942d2e"
PARENT_ID = "cfe32cf61b73a0d5e9f13e774abde7ff789b1660"
MESSAGE = "Files, encoding and much more"
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets"
FILES_COUNT = 2
end
module Commit
ID = "570e7b2abdd848b95f2f578043fc23bd6f6fd24d".freeze
PARENT_ID = "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9".freeze
MESSAGE = "Change some files\n\nSigned-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>\n".freeze
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze
ID = "570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
PARENT_ID = "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9"
MESSAGE = "Change some files\n\nSigned-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>\n"
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets"
FILES = ["files/ruby/popen.rb", "files/ruby/regex.rb"].freeze
FILES_COUNT = 2
C_FILE_PATH = "files/ruby".freeze
C_FILE_PATH = "files/ruby"
C_FILES = ["popen.rb", "regex.rb", "version_info.rb"].freeze
BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n}.freeze
BLOB_FILE_PATH = "app/views/keys/show.html.haml".freeze
BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n}
BLOB_FILE_PATH = "app/views/keys/show.html.haml"
end
module EmptyCommit
ID = "b0e52af38d7ea43cf41d8a6f2471351ac036d6c9".freeze
PARENT_ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d".freeze
MESSAGE = "Empty commit".freeze
AUTHOR_FULL_NAME = "Rémy Coutable".freeze
ID = "b0e52af38d7ea43cf41d8a6f2471351ac036d6c9"
PARENT_ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d"
MESSAGE = "Empty commit"
AUTHOR_FULL_NAME = "Rémy Coutable"
FILES = [].freeze
FILES_COUNT = FILES.count
end
module EncodingCommit
ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d".freeze
PARENT_ID = "66028349a123e695b589e09a36634d976edcc5e8".freeze
MESSAGE = "Add ISO-8859-encoded file".freeze
AUTHOR_FULL_NAME = "Stan Hu".freeze
ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d"
PARENT_ID = "66028349a123e695b589e09a36634d976edcc5e8"
MESSAGE = "Add ISO-8859-encoded file"
AUTHOR_FULL_NAME = "Stan Hu"
FILES = ["encoding/iso8859.txt"].freeze
FILES_COUNT = FILES.count
end
module FirstCommit
ID = "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863".freeze
ID = "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863"
PARENT_ID = nil
MESSAGE = "Initial commit".freeze
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze
MESSAGE = "Initial commit"
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets"
FILES = ["LICENSE", ".gitignore", "README.md"].freeze
FILES_COUNT = 3
end
module LastCommit
ID = "4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6".freeze
PARENT_ID = "0e1b353b348f8477bdbec1ef47087171c5032cd9".freeze
MESSAGE = "Merge branch 'master' into 'master'".freeze
AUTHOR_FULL_NAME = "Stan Hu".freeze
ID = "4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6"
PARENT_ID = "0e1b353b348f8477bdbec1ef47087171c5032cd9"
MESSAGE = "Merge branch 'master' into 'master'"
AUTHOR_FULL_NAME = "Stan Hu"
FILES = ["bin/executable"].freeze
FILES_COUNT = FILES.count
end
module Repo
HEAD = "master".freeze
HEAD = "master"
BRANCHES = %w[
feature
fix
@ -111,9 +111,9 @@ module SeedRepo
end
module RubyBlob
ID = "7e3e39ebb9b2bf433b4ad17313770fbe4051649c".freeze
NAME = "popen.rb".freeze
CONTENT = <<-eos.freeze
ID = "7e3e39ebb9b2bf433b4ad17313770fbe4051649c"
NAME = "popen.rb"
CONTENT = <<-eos
require 'fileutils'
require 'open3'