Skip to content
Snippets Groups Projects
Commit b7d8df50 authored by Douwe Maan's avatar Douwe Maan
Browse files

Enable Style/MutableConstant

parent 3dadf306
No related branches found
No related tags found
No related merge requests found
Showing
with 30 additions and 32 deletions
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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:
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@ class Admin::SystemInfoController < Admin::ApplicationController
'nobrowse',
'read-only',
'ro'
]
].freeze
 
EXCLUDED_MOUNT_TYPES = [
'autofs',
Loading
Loading
@@ -27,7 +27,7 @@ class Admin::SystemInfoController < Admin::ApplicationController
'tmpfs',
'tracefs',
'vfat'
]
].freeze
 
def show
@cpus = Vmstat.cpu rescue nil
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@ class JwtController < ApplicationController
 
SERVICES = {
Auth::ContainerRegistryAuthenticationService::AUDIENCE => Auth::ContainerRegistryAuthenticationService,
}
}.freeze
 
def auth
service = SERVICES[params[:service]]
Loading
Loading
Loading
Loading
@@ -19,7 +19,7 @@
# iids: integer[]
#
class IssuableFinder
NONE = '0'
NONE = '0'.freeze
 
attr_accessor :current_user, :params
 
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@
#
 
class TodosFinder
NONE = '0'
NONE = '0'.freeze
 
attr_accessor :current_user, :params
 
Loading
Loading
Loading
Loading
@@ -198,7 +198,7 @@ module IssuablesHelper
@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)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -4,8 +4,8 @@ module Ci
 
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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -45,7 +45,7 @@ module CacheMarkdownField
Project
Release
Snippet
]
].freeze
 
def self.caching_classes
CACHING_CLASSES.map(&:constantize)
Loading
Loading
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
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
class GroupMember < Member
SOURCE_TYPE = 'Namespace'
SOURCE_TYPE = 'Namespace'.freeze
 
belongs_to :group, foreign_key: 'source_id'
 
Loading
Loading
class ProjectMember < Member
SOURCE_TYPE = 'Project'
SOURCE_TYPE = 'Project'.freeze
 
include Gitlab::ShellAdapter
 
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment