This instance will be upgraded to Heptapod 0.27.1 on 2021-12-08 at 22:00 UTC+1 (a few minutes of down time)

Commit b7d8df50 authored by Douwe Maan's avatar Douwe Maan
Browse files

Enable Style/MutableConstant

parent ad222f96ec59
......@@ -308,6 +308,9 @@ Style/MultilineOperationIndentation:
Style/MultilineTernaryOperator:
Enabled: true
Style/MutableConstant:
Enabled: true
# Favor unless over if for negative conditions (or control flow or).
Style/NegatedIf:
Enabled: true
......
......@@ -471,11 +471,6 @@ Style/MultilineIfModifier:
- 'app/models/project_wiki.rb'
- 'lib/gitlab/workhorse.rb'
# Offense count: 187
# Cop supports --auto-correct.
Style/MutableConstant:
Enabled: false
# Offense count: 8
# Cop supports --auto-correct.
Style/NestedParenthesizedCalls:
......
......@@ -3,7 +3,7 @@ class Admin::SystemInfoController < Admin::ApplicationController
'nobrowse',
'read-only',
'ro'
]
].freeze
EXCLUDED_MOUNT_TYPES = [
'autofs',
......@@ -27,7 +27,7 @@ class Admin::SystemInfoController < Admin::ApplicationController
'tmpfs',
'tracefs',
'vfat'
]
].freeze
def show
@cpus = Vmstat.cpu rescue nil
......
......@@ -59,10 +59,10 @@ module ServiceParams
:user_key,
:username,
:webhook
]
].freeze
# Parameters to ignore if no value is specified
FILTER_BLANK_PARAMS = [:password]
FILTER_BLANK_PARAMS = [:password].freeze
def service_params
dynamic_params = @service.event_channel_names + @service.event_names
......
......@@ -5,7 +5,7 @@ class JwtController < ApplicationController
SERVICES = {
Auth::ContainerRegistryAuthenticationService::AUDIENCE => Auth::ContainerRegistryAuthenticationService,
}
}.freeze
def auth
service = SERVICES[params[:service]]
......
......@@ -19,7 +19,7 @@
# iids: integer[]
#
class IssuableFinder
NONE = '0'
NONE = '0'.freeze
attr_accessor :current_user, :params
......
......@@ -13,7 +13,7 @@
#
class TodosFinder
NONE = '0'
NONE = '0'.freeze
attr_accessor :current_user, :params
......
......@@ -198,7 +198,7 @@ def issuables_count_for_state(issuable_type, state)
@counts[issuable_type][state]
end
IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page]
IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page].freeze
private_constant :IRRELEVANT_PARAMS_FOR_CACHE_KEY
def issuables_state_counter_cache_key(issuable_type, state)
......
......@@ -5,7 +5,7 @@ class ApplicationSetting < ActiveRecord::Base
add_authentication_token_field :runners_registration_token
add_authentication_token_field :health_check_access_token
CACHE_KEY = 'application_setting.last'
CACHE_KEY = 'application_setting.last'.freeze
DOMAIN_LIST_SEPARATOR = %r{\s*[,;]\s* # comma or semicolon, optionally surrounded by whitespace
| # or
\s # any whitespace character
......
......@@ -4,8 +4,8 @@ class Runner < ActiveRecord::Base
RUNNER_QUEUE_EXPIRY_TIME = 60.minutes
LAST_CONTACT_TIME = 1.hour.ago
AVAILABLE_SCOPES = %w[specific shared active paused online]
FORM_EDITABLE = %i[description tag_list active run_untagged locked]
AVAILABLE_SCOPES = %w[specific shared active paused online].freeze
FORM_EDITABLE = %i[description tag_list active run_untagged locked].freeze
has_many :builds
has_many :runner_projects, dependent: :destroy
......
......@@ -22,7 +22,7 @@ class Commit
DIFF_HARD_LIMIT_LINES = 50000
# The SHA can be between 7 and 40 hex characters.
COMMIT_SHA_PATTERN = '\h{7,40}'
COMMIT_SHA_PATTERN = '\h{7,40}'.freeze
class << self
def decorate(commits, project)
......
......@@ -45,7 +45,7 @@ def html_fields
Project
Release
Snippet
]
].freeze
def self.caching_classes
CACHING_CLASSES.map(&:constantize)
......
module HasStatus
extend ActiveSupport::Concern
DEFAULT_STATUS = 'created'
AVAILABLE_STATUSES = %w[created pending running success failed canceled skipped]
STARTED_STATUSES = %w[running success failed skipped]
ACTIVE_STATUSES = %w[pending running]
COMPLETED_STATUSES = %w[success failed canceled skipped]
ORDERED_STATUSES = %w[failed pending running canceled success skipped]
DEFAULT_STATUS = 'created'.freeze
AVAILABLE_STATUSES = %w[created pending running success failed canceled skipped].freeze
STARTED_STATUSES = %w[running success failed skipped].freeze
ACTIVE_STATUSES = %w[pending running].freeze
COMPLETED_STATUSES = %w[success failed canceled skipped].freeze
ORDERED_STATUSES = %w[failed pending running canceled success skipped].freeze
class_methods do
def status_sql
......
......@@ -11,7 +11,7 @@ class Label < ActiveRecord::Base
cache_markdown_field :description, pipeline: :single_line
DEFAULT_COLOR = '#428BCA'
DEFAULT_COLOR = '#428BCA'.freeze
default_value_for :color, DEFAULT_COLOR
......
class GroupMember < Member
SOURCE_TYPE = 'Namespace'
SOURCE_TYPE = 'Namespace'.freeze
belongs_to :group, foreign_key: 'source_id'
......
class ProjectMember < Member
SOURCE_TYPE = 'Project'
SOURCE_TYPE = 'Project'.freeze
include Gitlab::ShellAdapter
......
......@@ -7,7 +7,7 @@ class MergeRequestDiff < ActiveRecord::Base
COMMITS_SAFE_SIZE = 100
# Valid types of serialized diffs allowed by Gitlab::Git::Diff
VALID_CLASSES = [Hash, Rugged::Patch, Rugged::Diff::Delta]
VALID_CLASSES = [Hash, Rugged::Patch, Rugged::Diff::Delta].freeze
belongs_to :merge_request
......
......@@ -35,11 +35,11 @@ class NotificationSetting < ActiveRecord::Base
:merge_merge_request,
:failed_pipeline,
:success_pipeline
]
].freeze
EXCLUDED_WATCHER_EVENTS = [
:success_pipeline
]
].freeze
store :events, accessors: EMAIL_EVENTS, coder: JSON
......
......@@ -22,7 +22,7 @@ class Project < ActiveRecord::Base
class BoardLimitExceeded < StandardError; end
NUMBER_OF_PERMITTED_BOARDS = 1
UNKNOWN_IMPORT_URL = 'http://unknown.git'
UNKNOWN_IMPORT_URL = 'http://unknown.git'.freeze
cache_markdown_field :description, pipeline: :description
......
......@@ -18,7 +18,7 @@ class ProjectFeature < ActiveRecord::Base
PRIVATE = 10
ENABLED = 20
FEATURES = %i(issues merge_requests wiki snippets builds repository)
FEATURES = %i(issues merge_requests wiki snippets builds repository).freeze
class << self
def access_level_attribute(feature)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment