diff --git a/.rubocop.yml b/.rubocop.yml index b684e989a..5b4e59505 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -47,3 +47,7 @@ Style/PerlBackrefs: Exclude: - app/helpers/shipit/shipit_helper.rb - app/models/shipit/pull_request.rb + +# This cop is broken https://github.com/rubocop-hq/rubocop/pull/7531 +Layout/RescueEnsureAlignment: + Enabled: false diff --git a/app/models/shipit/commit_deployment.rb b/app/models/shipit/commit_deployment.rb index 58e5ca638..79fb694b9 100644 --- a/app/models/shipit/commit_deployment.rb +++ b/app/models/shipit/commit_deployment.rb @@ -21,14 +21,14 @@ def create_deployment_on_github! response = begin create_deployment_on_github(author.github_api) - rescue Octokit::ClientError - raise if Shipit.github.api == author.github_api - # If the deploy author didn't gave us the permission to create the deployment we falback the the main shipit - # user. - # - # Octokit currently raise NotFound, but I'm convinced it should be Forbidden if the user can see the repository. - # So to be future proof I catch boths. - create_deployment_on_github(Shipit.github.api) + rescue Octokit::ClientError + raise if Shipit.github.api == author.github_api + # If the deploy author didn't gave us the permission to create the deployment we falback the the main shipit + # user. + # + # Octokit currently raise NotFound, but I'm convinced it should be Forbidden if the user can see the repository. + # So to be future proof I catch boths. + create_deployment_on_github(Shipit.github.api) end update!(github_id: response.id, api_url: response.url) end diff --git a/app/models/shipit/commit_deployment_status.rb b/app/models/shipit/commit_deployment_status.rb index 4aad44a5f..c0fbd0056 100644 --- a/app/models/shipit/commit_deployment_status.rb +++ b/app/models/shipit/commit_deployment_status.rb @@ -13,14 +13,14 @@ def create_on_github! return if github_id? response = begin create_status_on_github(author.github_api) - rescue Octokit::ClientError - raise if Shipit.github.api == author.github_api - # If the deploy author didn't gave us the permission to create the deployment we falback the the main shipit - # user. - # - # Octokit currently raise NotFound, but I'm convinced it should be Forbidden if the user can see the repository. - # So to be future proof I catch boths. - create_status_on_github(Shipit.github.api) + rescue Octokit::ClientError + raise if Shipit.github.api == author.github_api + # If the deploy author didn't gave us the permission to create the deployment we falback the the main shipit + # user. + # + # Octokit currently raise NotFound, but I'm convinced it should be Forbidden if the user can see the repository. + # So to be future proof I catch boths. + create_status_on_github(Shipit.github.api) end update!(github_id: response.id, api_url: response.url) end diff --git a/app/models/shipit/pull_request.rb b/app/models/shipit/pull_request.rb index c30d2d674..793261d2b 100644 --- a/app/models/shipit/pull_request.rb +++ b/app/models/shipit/pull_request.rb @@ -130,8 +130,8 @@ def self.request_merge!(stack, number, user) stack: stack, number: number, ) - rescue ActiveRecord::RecordNotUnique - retry + rescue ActiveRecord::RecordNotUnique + retry end pull_request.update!(merge_requested_by: user.presence) pull_request.retry! if pull_request.rejected? || pull_request.canceled? || pull_request.revalidating?