Merge branch '15139-fix-constants-redefinition-warnings' into 'master'
Define constants only if not defined yet and freeze them Fixes #15139. See merge request !3810
This commit is contained in:
commit
6a19467c41
10 changed files with 6 additions and 17 deletions
|
@ -15,8 +15,8 @@ class Commit
|
|||
DIFF_SAFE_LINES = Gitlab::Git::DiffCollection::DEFAULT_LIMITS[:max_lines]
|
||||
|
||||
# Commits above this size will not be rendered in HTML
|
||||
DIFF_HARD_LIMIT_FILES = 1000 unless defined?(DIFF_HARD_LIMIT_FILES)
|
||||
DIFF_HARD_LIMIT_LINES = 50000 unless defined?(DIFF_HARD_LIMIT_LINES)
|
||||
DIFF_HARD_LIMIT_FILES = 1000
|
||||
DIFF_HARD_LIMIT_LINES = 50000
|
||||
|
||||
class << self
|
||||
def decorate(commits, project)
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#
|
||||
|
||||
require 'carrierwave/orm/activerecord'
|
||||
require 'file_size_validator'
|
||||
|
||||
class Group < Namespace
|
||||
include Gitlab::ConfigHelper
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#
|
||||
|
||||
require 'carrierwave/orm/activerecord'
|
||||
require 'file_size_validator'
|
||||
|
||||
class Issue < ActiveRecord::Base
|
||||
include InternalId
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
# merge_commit_sha :string
|
||||
#
|
||||
|
||||
require Rails.root.join("app/models/commit")
|
||||
require Rails.root.join("lib/static_model")
|
||||
|
||||
class MergeRequest < ActiveRecord::Base
|
||||
include InternalId
|
||||
include Issuable
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
# updated_at :datetime
|
||||
#
|
||||
|
||||
require Rails.root.join("app/models/commit")
|
||||
|
||||
class MergeRequestDiff < ActiveRecord::Base
|
||||
include Sortable
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#
|
||||
|
||||
require 'carrierwave/orm/activerecord'
|
||||
require 'file_size_validator'
|
||||
|
||||
class Note < ActiveRecord::Base
|
||||
include Gitlab::CurrentSettings
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#
|
||||
|
||||
require 'carrierwave/orm/activerecord'
|
||||
require 'file_size_validator'
|
||||
|
||||
class Project < ActiveRecord::Base
|
||||
include Gitlab::ConfigHelper
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#
|
||||
|
||||
require 'carrierwave/orm/activerecord'
|
||||
require 'file_size_validator'
|
||||
|
||||
class ProjectImportData < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
#
|
||||
|
||||
require 'carrierwave/orm/activerecord'
|
||||
require 'file_size_validator'
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
extend Gitlab::ConfigHelper
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
class FileSizeValidator < ActiveModel::EachValidator
|
||||
MESSAGES = { is: :wrong_size, minimum: :size_too_small, maximum: :size_too_big }.freeze
|
||||
CHECKS = { is: :==, minimum: :>=, maximum: :<= }.freeze
|
||||
MESSAGES = { is: :wrong_size, minimum: :size_too_small, maximum: :size_too_big }.freeze
|
||||
CHECKS = { is: :==, minimum: :>=, maximum: :<= }.freeze
|
||||
|
||||
DEFAULT_TOKENIZER = lambda { |value| value.split(//) }
|
||||
RESERVED_OPTIONS = [:minimum, :maximum, :within, :is, :tokenizer, :too_short, :too_long]
|
||||
DEFAULT_TOKENIZER = -> (value) { value.split(//) }.freeze
|
||||
RESERVED_OPTIONS = [:minimum, :maximum, :within, :is, :tokenizer, :too_short, :too_long].freeze
|
||||
|
||||
def initialize(options)
|
||||
if range = (options.delete(:in) || options.delete(:within))
|
||||
|
|
Loading…
Reference in a new issue