DEV: Prefer \A and \z over ^ and $ in regexes (#19936)

This commit is contained in:
Daniel Waterworth
2023-01-20 12:52:49 -06:00
committed by GitHub
parent f7907a3645
commit 666536cbd1
115 changed files with 294 additions and 291 deletions

View File

@@ -15,8 +15,8 @@ class RemoteTheme < ActiveRecord::Base
ALLOWED_FIELDS = %w[scss embedded_scss head_tag header after_header body_tag footer]
GITHUB_REGEXP = %r{^https?://github\.com/}
GITHUB_SSH_REGEXP = %r{^ssh://git@github\.com:}
GITHUB_REGEXP = %r{\Ahttps?://github\.com/}
GITHUB_SSH_REGEXP = %r{\Assh://git@github\.com:}
has_one :theme, autosave: false
scope :joined_remotes,
@@ -329,7 +329,7 @@ class RemoteTheme < ActiveRecord::Base
def github_diff_link
if github_repo_url.present? && local_version != remote_version
"#{github_repo_url.gsub(/\.git$/, "")}/compare/#{local_version}...#{remote_version}"
"#{github_repo_url.gsub(/\.git\z/, "")}/compare/#{local_version}...#{remote_version}"
end
end