Fix ReturnInVoidContext rubocop offense

This commit is contained in:
Semyon Pupkov 2019-02-01 12:51:08 +05:00
parent 9a0dd375f3
commit 63d220f237
2 changed files with 7 additions and 10 deletions

View File

@ -80,11 +80,6 @@ Lint/InterpolationCheck:
Lint/MissingCopEnableDirective:
Enabled: false
# Offense count: 1
Lint/ReturnInVoidContext:
Exclude:
- 'app/models/project.rb'
# Offense count: 9
Lint/UriEscapeUnescape:
Exclude:

View File

@ -738,11 +738,13 @@ class Project < ActiveRecord::Base
end
def import_url=(value)
return super(value) unless Gitlab::UrlSanitizer.valid?(value)
import_url = Gitlab::UrlSanitizer.new(value)
super(import_url.sanitized_url)
create_or_update_import_data(credentials: import_url.credentials)
if Gitlab::UrlSanitizer.valid?(value)
import_url = Gitlab::UrlSanitizer.new(value)
super(import_url.sanitized_url)
create_or_update_import_data(credentials: import_url.credentials)
else
super(value)
end
end
def import_url