diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-08-27 17:31:01 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-11 17:32:00 +0200 |
commit | 2039c8280db1646845c33d6c5a74e5f23ca6f4de (patch) | |
tree | e2b3cd3012d9711cda7c6afb962ae4228d59521a /app/models/member.rb | |
parent | 91c40973dc620430b173ea2df968587d2a708dff (diff) | |
download | gitlab-ce-2039c8280db1646845c33d6c5a74e5f23ca6f4de.tar.gz |
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
Diffstat (limited to 'app/models/member.rb')
-rw-r--r-- | app/models/member.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/member.rb b/app/models/member.rb index d9b4e8d2ac6..0696ea46c8b 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -145,6 +145,7 @@ class Member < ActiveRecord::Base end def add_user(source, user, access_level, existing_members: nil, current_user: nil, expires_at: nil, ldap: false) + # rubocop: disable CodeReuse/ServiceClass # `user` can be either a User object, User ID or an email to be invited member = retrieve_member(source, user, existing_members) access_level = retrieve_access_level(access_level) @@ -171,6 +172,7 @@ class Member < ActiveRecord::Base end member + # rubocop: enable CodeReuse/ServiceClass end def add_users(source, users, access_level, current_user: nil, expires_at: nil) @@ -339,12 +341,14 @@ class Member < ActiveRecord::Base @notification_setting ||= user&.notification_settings_for(source) end + # rubocop: disable CodeReuse/ServiceClass def notifiable?(type, opts = {}) # always notify when there isn't a user yet return true if user.blank? NotificationRecipientService.notifiable?(user, type, notifiable_options.merge(opts)) end + # rubocop: enable CodeReuse/ServiceClass private @@ -374,6 +378,7 @@ class Member < ActiveRecord::Base # in a transaction. Doing so can lead to the job running before the # transaction has been committed, resulting in the job either throwing an # error or not doing any meaningful work. + # rubocop: disable CodeReuse/ServiceClass def refresh_member_authorized_projects # If user/source is being destroyed, project access are going to be # destroyed eventually because of DB foreign keys, so we shouldn't bother @@ -382,6 +387,7 @@ class Member < ActiveRecord::Base UserProjectAccessChangedService.new(user_id).execute end + # rubocop: enable CodeReuse/ServiceClass def after_accept_invite post_create_hook @@ -395,13 +401,17 @@ class Member < ActiveRecord::Base post_create_hook end + # rubocop: disable CodeReuse/ServiceClass def system_hook_service SystemHooksService.new end + # rubocop: enable CodeReuse/ServiceClass + # rubocop: disable CodeReuse/ServiceClass def notification_service NotificationService.new end + # rubocop: enable CodeReuse/ServiceClass def notifiable_options {} |