diff options
author | Rémy Coutable <remy@rymai.me> | 2019-02-04 09:26:24 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-02-04 09:26:24 +0000 |
commit | 49f9502d73c105b4355a6480083c6cb32ee8389b (patch) | |
tree | 332cfdbd34276fa78f2c3d2774a95bfb913f46b1 | |
parent | b9f0eff9fc72e891e2ccf910b3fcd52539bc48fb (diff) | |
parent | b43ffd0d42ae5129ed63a18ccd45abb6f026411a (diff) | |
download | gitlab-ce-49f9502d73c105b4355a6480083c6cb32ee8389b.tar.gz |
Merge branch 'fix-rubocop' into 'master'
Fix ReturnInVoidContext rubocop offense
See merge request gitlab-org/gitlab-ce!24857
-rw-r--r-- | .rubocop_todo.yml | 5 | ||||
-rw-r--r-- | app/models/project.rb | 12 | ||||
-rw-r--r-- | spec/factories/projects.rb | 2 |
3 files changed, 8 insertions, 11 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c42d11a860e..77ad4753c84 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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: diff --git a/app/models/project.rb b/app/models/project.rb index b385b89449d..e55a57e46ef 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 1906c06a211..18fab395cc2 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -1,7 +1,7 @@ require_relative '../support/helpers/test_env' FactoryBot.define do - PAGES_ACCESS_LEVEL_SCHEMA_VERSION = 20180423204600 + PAGES_ACCESS_LEVEL_SCHEMA_VERSION ||= 20180423204600 # Project without repository # |