Skip to content

Commit 039e978

Browse files
committed
Fix rubocop errors
1 parent 672bf53 commit 039e978

File tree

11 files changed

+15
-15
lines changed

11 files changed

+15
-15
lines changed

app/actions/app_apply_manifest.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def validate_name_dns_compliant!(name)
136136

137137
error!(prefix + ' Host cannot exceed 63 characters') if name.present? && name.length > 63
138138

139-
return if name&.match(/\A[\w\-]+\z/)
139+
return if name&.match(/\A[\w-]+\z/)
140140

141141
error!(prefix + ' Host must be either "*" or contain only alphanumeric characters, "_", or "-"')
142142
end

app/messages/domain_create_message.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def self.relationships_requested?
4545

4646
validates :name,
4747
format: {
48-
with: /\A^([^\.]{0,63}\.)*[^\.]{0,63}$\Z/,
48+
with: /\A^([^.]{0,63}\.)*[^.]{0,63}$\Z/,
4949
message: 'subdomains must each be at most 63 characters'
5050
}
5151

@@ -74,7 +74,7 @@ def router_group_guid
7474
private
7575

7676
def alpha_numeric
77-
return unless /[^a-z0-9\-\.]/i.match?(name.to_s)
77+
return unless /[^a-z0-9\-.]/i.match?(name.to_s)
7878

7979
errors.add(:name, 'must consist of alphanumeric characters and hyphens')
8080
end

app/messages/metadata_validator_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class MetadataValidatorHelper
88
MAX_METADATA_KEY_SIZE = 63
99
MAX_METADATA_PREFIX_SIZE = 253
1010

11-
INVALID_CHAR_REGEX = /[^\w\-\.]/
11+
INVALID_CHAR_REGEX = /[^\w\-.]/
1212
ALPHANUMERIC_START_END_REGEX = /\A(?=[a-zA-Z\d]).*[a-zA-Z\d]\z/
1313

1414
RESERVED_DOMAIN = 'cloudfoundry.org'.freeze

app/messages/route_create_message.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def self.options_requested?
2525
maximum: MAXIMUM_DOMAIN_LABEL_LENGTH
2626
},
2727
format: {
28-
with: /\A([\w\-]+|\*)?\z/,
28+
with: /\A([\w-]+|\*)?\z/,
2929
message: 'must be either "*" or contain only alphanumeric characters, "_", or "-"'
3030
}
3131

app/models/helpers/metadata_helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module VCAP::CloudController
22
class MetadataHelpers
33
KEY_SEPARATOR = '/'.freeze
44
REQUIREMENT_SPLITTER = /(?:\(.*?\)|[^,])+/
5-
KEY_CHARACTERS = %r{[\w\-\.\_\/]+}
5+
KEY_CHARACTERS = %r{[\w\-._/]+}
66

77
IN_PATTERN = /\A(?<key>.*?) in \((?<values>.*)\)\z/ # foo in (bar,baz)
88
NOT_IN_PATTERN = /\A(?<key>.*?) notin \((?<values>.*)\)\z/ # funky notin (uptown,downtown)

app/models/runtime/route.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def validate
109109

110110
errors.add(:host, :presence) if host.nil?
111111

112-
validates_format(/\A([\w\-]+|\*)\z/, :host) if host && !host.empty?
112+
validates_format(/\A([\w-]+|\*)\z/, :host) if host && !host.empty?
113113

114114
validate_uniqueness_on_host_and_domain if path.empty? && port.nil?
115115
validate_uniqueness_on_host_domain_and_port if path.empty?

lib/cloud_controller/domain_decorator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module CloudController
22
class DomainDecorator
3-
DOMAIN_REGEX = /\A(([a-z0-9]|[a-z0-9][a-z0-9\-]{0,61}[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9\-]{0,61}[a-z0-9])\Z/ix
3+
DOMAIN_REGEX = /\A(([a-z0-9]|[a-z0-9][a-z0-9-]{0,61}[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9-]{0,61}[a-z0-9])\Z/ix
44
DOMAIN_DELIMITER = '.'.freeze
55

66
attr_reader :name

lib/utils/uri_utils.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module UriUtils
44
SSH_REGEX = %r{ \A (?:ssh://)? git@ .+? : .+? \.git \z }x
55
GIT_REGEX = %r{ \A git:// .+? : .+? \.git \z }x
66
DOCKER_INDEX_SERVER = 'docker.io'.freeze
7-
DOCKER_PATH_REGEX = %r{\A[a-z0-9_\-\.\/]{2,255}\Z}
8-
DOCKER_TAG_REGEX = /[a-zA-Z0-9_\-\.]{1,128}/
7+
DOCKER_PATH_REGEX = %r{\A[a-z0-9_\-./]{2,255}\Z}
8+
DOCKER_TAG_REGEX = /[a-zA-Z0-9_\-.]{1,128}/
99
DOCKER_DIGEST_REGEX = /sha256:[a-z0-9]{64}/
1010
DOCKER_TAG_DIGEST_REGEX = Regexp.new("\\A(#{DOCKER_TAG_REGEX.source} |
1111
(#{DOCKER_TAG_REGEX.source}@#{DOCKER_DIGEST_REGEX.source}) | #{DOCKER_DIGEST_REGEX.source})\\Z", Regexp::EXTENDED)
@@ -36,7 +36,7 @@ def self.is_cnb_buildpack_uri?(candidate)
3636
end
3737

3838
def self.is_uri_path?(candidate)
39-
!!(candidate.is_a?(String) && candidate =~ %r{^(?:/|/([^\s/][\S]*)?)$})
39+
!!(candidate.is_a?(String) && candidate =~ %r{^(?:/|/([^\s/]\S*)?)$})
4040
end
4141

4242
# This escapes only the values in queries.

middleware/vcap_request_id.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def external_request_id(env)
2828
request_id = env['HTTP_X_VCAP_REQUEST_ID'].presence || env['HTTP_X_REQUEST_ID'].presence
2929
return unless request_id
3030

31-
"#{request_id.gsub(/[^\w\-]/, '').first(255)}::#{SecureRandom.uuid}"
31+
"#{request_id.gsub(/[^\w-]/, '').first(255)}::#{SecureRandom.uuid}"
3232
end
3333

3434
def internal_request_id

spec/support/time_helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ def iso8601
77

88
# https://gist.github.com/marcelotmelo/b67f58a08bee6c2468f8
99
def rfc3339
10-
/^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))$/
10+
/^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([+|-]([01][0-9]|2[0-3]):[0-5][0-9]))$/
1111
end
1212
end

0 commit comments

Comments
 (0)