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
720ed6f6
Commit
720ed6f6
authored
Jun 27, 2018
by
gfyoung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable frozen string in apps/validators/*.rb
Partially addresses #47424.
parent
f63e234b
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
45 additions
and
2 deletions
+45
-2
app/validators/abstract_path_validator.rb
app/validators/abstract_path_validator.rb
+2
-0
app/validators/certificate_fingerprint_validator.rb
app/validators/certificate_fingerprint_validator.rb
+2
-0
app/validators/certificate_key_validator.rb
app/validators/certificate_key_validator.rb
+2
-0
app/validators/certificate_validator.rb
app/validators/certificate_validator.rb
+2
-0
app/validators/cluster_name_validator.rb
app/validators/cluster_name_validator.rb
+2
-0
app/validators/color_validator.rb
app/validators/color_validator.rb
+2
-0
app/validators/cron_timezone_validator.rb
app/validators/cron_timezone_validator.rb
+2
-0
app/validators/cron_validator.rb
app/validators/cron_validator.rb
+2
-0
app/validators/duration_validator.rb
app/validators/duration_validator.rb
+2
-0
app/validators/email_validator.rb
app/validators/email_validator.rb
+2
-0
app/validators/key_restriction_validator.rb
app/validators/key_restriction_validator.rb
+2
-0
app/validators/line_code_validator.rb
app/validators/line_code_validator.rb
+2
-0
app/validators/namespace_name_validator.rb
app/validators/namespace_name_validator.rb
+2
-0
app/validators/namespace_path_validator.rb
app/validators/namespace_path_validator.rb
+2
-0
app/validators/project_path_validator.rb
app/validators/project_path_validator.rb
+2
-0
app/validators/public_url_validator.rb
app/validators/public_url_validator.rb
+2
-0
app/validators/top_level_group_validator.rb
app/validators/top_level_group_validator.rb
+2
-0
app/validators/url_validator.rb
app/validators/url_validator.rb
+2
-0
app/validators/variable_duplicates_validator.rb
app/validators/variable_duplicates_validator.rb
+4
-2
changelogs/unreleased/frozen-string-enable-app-validators.yml
...gelogs/unreleased/frozen-string-enable-app-validators.yml
+5
-0
No files found.
app/validators/abstract_path_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
class
AbstractPathValidator
<
ActiveModel
::
EachValidator
extend
Gitlab
::
EncodingHelper
...
...
app/validators/certificate_fingerprint_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
class
CertificateFingerprintValidator
<
ActiveModel
::
EachValidator
FINGERPRINT_PATTERN
=
/\A([a-zA-Z0-9]{2}[\s\-:]?){16,}\z/
.
freeze
...
...
app/validators/certificate_key_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# UrlValidator
#
# Custom validator for private keys.
...
...
app/validators/certificate_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# UrlValidator
#
# Custom validator for private keys.
...
...
app/validators/cluster_name_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# ClusterNameValidator
#
# Custom validator for ClusterName.
...
...
app/validators/color_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# ColorValidator
#
# Custom validator for web color codes. It requires the leading hash symbol and
...
...
app/validators/cron_timezone_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# CronTimezoneValidator
#
# Custom validator for CronTimezone.
...
...
app/validators/cron_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# CronValidator
#
# Custom validator for Cron.
...
...
app/validators/duration_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# DurationValidator
#
# Validate the format conforms with ChronicDuration
...
...
app/validators/email_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
class
EmailValidator
<
ActiveModel
::
EachValidator
def
validate_each
(
record
,
attribute
,
value
)
record
.
errors
.
add
(
attribute
,
:invalid
)
unless
value
=~
Devise
.
email_regexp
...
...
app/validators/key_restriction_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
class
KeyRestrictionValidator
<
ActiveModel
::
EachValidator
FORBIDDEN
=
-
1
...
...
app/validators/line_code_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# LineCodeValidator
#
# Custom validator for GitLab line codes.
...
...
app/validators/namespace_name_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# NamespaceNameValidator
#
# Custom validator for GitLab namespace name strings.
...
...
app/validators/namespace_path_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
class
NamespacePathValidator
<
AbstractPathValidator
extend
Gitlab
::
EncodingHelper
...
...
app/validators/project_path_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
class
ProjectPathValidator
<
AbstractPathValidator
extend
Gitlab
::
EncodingHelper
...
...
app/validators/public_url_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# PublicUrlValidator
#
# Custom validator for URLs. This validator works like UrlValidator but
...
...
app/validators/top_level_group_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
class
TopLevelGroupValidator
<
ActiveModel
::
EachValidator
def
validate_each
(
record
,
attribute
,
value
)
if
value
&
.
subgroup?
...
...
app/validators/url_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# UrlValidator
#
# Custom validator for URLs.
...
...
app/validators/variable_duplicates_validator.rb
View file @
720ed6f6
# frozen_string_literal: true
# VariableDuplicatesValidator
#
# This validator is designed for especially the following condition
...
...
@@ -22,8 +24,8 @@ class VariableDuplicatesValidator < ActiveModel::EachValidator
def
validate_duplicates
(
record
,
attribute
,
values
)
duplicates
=
values
.
reject
(
&
:marked_for_destruction?
).
group_by
(
&
:key
).
select
{
|
_
,
v
|
v
.
many?
}.
map
(
&
:first
)
if
duplicates
.
any?
error_message
=
"have duplicate values (
#{
duplicates
.
join
(
", "
)
}
)"
error_message
+=
" for
#{
values
.
first
.
send
(
options
[
:scope
])
}
scope"
if
options
[
:scope
]
# rubocop:disable GitlabSecurity/PublicSend
error_message
=
+
"have duplicate values (
#{
duplicates
.
join
(
", "
)
}
)"
error_message
<<
" for
#{
values
.
first
.
send
(
options
[
:scope
])
}
scope"
if
options
[
:scope
]
# rubocop:disable GitlabSecurity/PublicSend
record
.
errors
.
add
(
attribute
,
error_message
)
end
end
...
...
changelogs/unreleased/frozen-string-enable-app-validators.yml
0 → 100644
View file @
720ed6f6
---
title
:
Enable frozen string in apps/validators/*.rb
merge_request
:
20220
author
:
gfyoung
type
:
other
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