Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Rubocop violations #1340

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
inherit_from: .rubocop_todo.yml

AllCops:
Exclude:
- tmp/*
Expand Down Expand Up @@ -42,6 +40,11 @@ Lint/RescueException:
Exclude:
- app/models/shipit/task_execution_strategy/default.rb

Lint/MissingCopEnableDirective:
Exclude:
- 'lib/shipit/stack_commands.rb'
- 'lib/shipit/task_commands.rb'

Lint/SuppressedException:
Enabled: false

Expand All @@ -64,5 +67,31 @@ Style/WordArray:
Style/SymbolArray:
Enabled: false

Style/ClassMethodsDefinitions:
Exclude:
- 'app/models/shipit/commit.rb'
- 'app/models/shipit/deploy.rb'
- 'app/models/shipit/merge_request.rb'
- 'app/models/shipit/repository.rb'
- 'app/models/shipit/review_stack.rb'
- 'app/models/shipit/review_stack_provisioning_queue.rb'
- 'app/models/shipit/stack.rb'
- 'app/models/shipit/task.rb'
- 'app/models/shipit/user.rb'
- 'app/models/shipit/webhooks/handlers/handler.rb'
- 'lib/shipit/simple_message_verifier.rb'
- 'test/models/shipit/stack_test.rb'
- 'test/unit/shipit_deployment_checks_test.rb'

Style/OpenStructUse:
Exclude:
- 'test/jobs/update_github_last_deployed_ref_job_test.rb'
- 'test/models/commits_test.rb'
- 'test/models/shipit/check_run_test.rb'
- 'test/models/shipit/webhooks/handlers/pull_request/review_stack_adapter_test.rb'
- 'test/models/status_test.rb'
- 'test/unit/github_app_test.rb'
- 'test/unit/github_apps_test.rb'

Naming/InclusiveLanguage:
Enabled: false
204 changes: 0 additions & 204 deletions .rubocop_todo.yml

This file was deleted.

1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module ActiveModelSerializersPatch
private
Expand Down
1 change: 1 addition & 0 deletions app/controllers/concerns/shipit/api/cacheable.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
module Cacheable
Expand Down
1 change: 1 addition & 0 deletions app/controllers/concerns/shipit/api/paginable.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
module Paginable
Expand Down
1 change: 1 addition & 0 deletions app/controllers/concerns/shipit/api/rendering.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
module Rendering
Expand Down
1 change: 1 addition & 0 deletions app/controllers/concerns/shipit/authentication.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Authentication
extend ActiveSupport::Concern
Expand Down
1 change: 1 addition & 0 deletions app/controllers/concerns/shipit/pagination.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Pagination
extend ActiveSupport::Concern
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/shipit/api/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class BaseController < ActionController::Base
Expand Down Expand Up @@ -54,6 +55,7 @@ def authenticate_api_client
end
end
return if @current_api_client

headers['WWW-Authenticate'] = 'Basic realm="Authentication token"'
render(status: :unauthorized, json: { message: 'Bad credentials' })
end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/shipit/api/ccmenu_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class CCMenuController < BaseController
Expand Down
1 change: 1 addition & 0 deletions app/controllers/shipit/api/commits_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class CommitsController < BaseController
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/shipit/api/deploys_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class DeploysController < BaseController
Expand All @@ -21,8 +22,13 @@ def create
param_error!(:require_ci, "Commit is not deployable") if params.require_ci && !commit.deployable?

allow_concurrency = params.allow_concurrency.nil? ? params.force : params.allow_concurrency
deploy = stack.trigger_deploy(commit, current_user, env: params.env, force: params.force,
allow_concurrency: allow_concurrency)
deploy = stack.trigger_deploy(
commit,
current_user,
env: params.env,
force: params.force,
allow_concurrency: allow_concurrency,
)
render_resource(deploy, status: :accepted)
end
end
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/shipit/api/hooks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class HooksController < BaseController
Expand All @@ -15,7 +16,7 @@ def show

params do
requires :delivery_url, String
requires :events, Array[String]
requires :events, [String]
accepts :content_type, String
end
def create
Expand All @@ -24,7 +25,7 @@ def create

params do
accepts :delivery_url, String
accepts :events, Array[String]
accepts :events, [String]
accepts :content_type, String
end
def update
Expand Down
1 change: 1 addition & 0 deletions app/controllers/shipit/api/locks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class LocksController < BaseController
Expand Down
1 change: 1 addition & 0 deletions app/controllers/shipit/api/merge_requests_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class MergeRequestsController < BaseController
Expand Down
1 change: 1 addition & 0 deletions app/controllers/shipit/api/outputs_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class OutputsController < BaseController
Expand Down
1 change: 1 addition & 0 deletions app/controllers/shipit/api/release_statuses_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class ReleaseStatusesController < BaseController
Expand Down
1 change: 1 addition & 0 deletions app/controllers/shipit/api/rollbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module Shipit
module Api
class RollbacksController < BaseController
Expand Down
Loading
Loading