diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-08-27 18:31:01 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-11 18:32:00 +0300 |
commit | 2039c8280db1646845c33d6c5a74e5f23ca6f4de (patch) | |
tree | e2b3cd3012d9711cda7c6afb962ae4228d59521a /app/services/projects/create_service.rb | |
parent | 91c40973dc620430b173ea2df968587d2a708dff (diff) |
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/services/projects/create_service.rb')
-rw-r--r-- | app/services/projects/create_service.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 02a3a3eb096..0e6a7e8da54 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -79,17 +79,21 @@ module Projects @project.errors.add(:namespace, "is not valid") end + # rubocop: disable CodeReuse/ActiveRecord def allowed_fork?(source_project_id) return true if source_project_id.nil? source_project = Project.find_by(id: source_project_id) current_user.can?(:fork_project, source_project) end + # rubocop: enable CodeReuse/ActiveRecord + # rubocop: disable CodeReuse/ActiveRecord def allowed_namespace?(user, namespace_id) namespace = Namespace.find_by(id: namespace_id) current_user.can?(:create_projects, namespace) end + # rubocop: enable CodeReuse/ActiveRecord def after_create_actions log_info("#{@project.owner.name} created a new project \"#{@project.full_name}\"") @@ -167,12 +171,14 @@ module Projects @project end + # rubocop: disable CodeReuse/ActiveRecord def create_services_from_active_templates(project) Service.where(template: true, active: true).each do |template| service = Service.build_from_template(project.id, template) service.save! end end + # rubocop: enable CodeReuse/ActiveRecord def set_project_name_from_path # Set project name from path |