Open sagaekeiga opened 5 years ago
#!/bin/bash -eo pipefail
bundle exec rubocop --rails
Inspecting 70 files
..W....C...C.............C..WC...C....C.CWWW.......C.W.C..C..CC....W.C
Offenses:
app/helpers/application_helper.rb:20:9: W: Duplicated key in hash literal.
description: :description,
^^^^^^^^^^^
app/helpers/application_helper.rb:30:7: C: Rename is_same_action_name? to same_action_name?.
def is_same_action_name?(action_name)
^^^^^^^^^^^^^^^^^^^^
app/helpers/application_helper.rb:34:7: C: Rename is_same_controller_name? to same_controller_name?.
def is_same_controller_name?(controller_names)
^^^^^^^^^^^^^^^^^^^^^^^^
app/helpers/application_helper.rb:38:7: C: Rename is_same_controller_and_action_name? to same_controller_and_action_name?.
def is_same_controller_and_action_name?(controller_name, action_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/mailers/reviewee_mailer.rb:5:42: C: Redundant curly braces around a hash parameter.
@encode_member = JsonWebToken.encode({ 'member_id': @member.id })
^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/mailers/reviewee_mailer.rb:6:41: C: Redundant curly braces around a hash parameter.
@encode_owner = JsonWebToken.encode({ 'owner_id': @owner.id })
^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/api/v1/github_apps_controller.rb:35:5: C: Use a guard clause instead of wrapping the code inside a conditional expression.
if status
^^
app/controllers/reviewers/commits_controller.rb:10:1: C: Extra empty line detected at method body beginning.
app/controllers/reviewers/contents_controller.rb:4:22: W: Ambiguous splat operator. Parenthesize the method arguments if it's surely a splat operator, or add a whitespace to the right of the * if it should be a multiplication.
skip_before_action *%i(verify_authenticity_token set_skill! authenticate_reviewer!), only: %i(search)
^
app/controllers/reviewers/pulls_controller.rb:9:54: C: Space missing to the left of {.
@double_review_comments = @pull.changed_files.map{ |changed_file| changed_file.review_comments.includes(:reviewer) }
^
app/controllers/reviewers/review_comments_controller.rb:15:3: C: Assignment Branch Condition size for create is too high. [50.52/50]
def create
^^^
app/controllers/reviewers/issues_controller.rb:17:4: C: Inconsistent indentation detected.
def set_issue
^^^^^^^^^^^^^
app/controllers/reviewers/reviews_controller.rb:9:43: C: Space missing to the left of {.
numbers = @pull.body.scan(/#\d+/)&.map{ |num| num.delete('#').to_i }
^
app/controllers/reviewers/wikis_controller.rb:19:3: W: Method Reviewers::WikisController#set_repo is defined at both /home/circleci/push-request-v2/app/controllers/reviewers/wikis_controller.rb:15 and /home/circleci/push-request-v2/app/controllers/reviewers/wikis_controller.rb:19.
def set_repo
^^^
app/controllers/authentications_controller.rb:2:1: C: Extra empty line detected at class body beginning.
app/controllers/authentications_controller.rb:8:7: C: Indent when as deep as case.
when 'reviewee' then Reviewees
^^^^
app/controllers/authentications_controller.rb:9:7: C: Indent when as deep as case.
when 'reviewer' then Reviewers
^^^^
app/controllers/authentications_controller.rb:10:7: W: end at 10, 6 is not aligned with case at 7, 12.
end
^^^
app/controllers/authentications_controller.rb:26:5: C: Use the return of the conditional for variable assignment and comparison.
if params[:scope].eql?('repo')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/application_controller.rb:49:5: W: Useless assignment to variable - format.
format = params[:format] == :json ? :json : :html
^^^^^^
app/controllers/reviewees/registrations_controller.rb:66:3: C: Use empty lines between method definitions.
def after_update_path_for(_resource)
^^^
app/controllers/reviewees/memberships_controller.rb:2:22: W: Ambiguous splat operator. Parenthesize the method arguments if it's surely a splat operator, or add a whitespace to the right of the * if it should be a multiplication.
skip_before_action *%i(verify_authenticity_token authenticate_reviewee!), only: %i(create suggest)
^
app/controllers/reviewees/issues_controller.rb:30:4: C: Inconsistent indentation detected.
def set_issue
^^^^^^^^^^^^^
app/controllers/welcome_controller.rb:4:35: C: Place the . on the next line, together with the method name.
@pulls = Pull.request_reviewed.
^
app/controllers/welcome_controller.rb:5:7: C: Align includes with Pull.request_reviewed. on line 4.
includes(:repo).
^^^^^^^^
app/controllers/welcome_controller.rb:5:22: C: Place the . on the next line, together with the method name.
includes(:repo).
^
app/controllers/welcome_controller.rb:6:7: C: Align order with Pull.request_reviewed. on line 4.
order(created_at: :desc).
^^^^^
app/controllers/welcome_controller.rb:6:31: C: Place the . on the next line, together with the method name.
order(created_at: :desc).
^
app/controllers/welcome_controller.rb:7:7: C: Use find instead of select.first.
select{ |pull| pull.repo.private == false }.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/welcome_controller.rb:7:7: C: Align select with Pull.request_reviewed. on line 4.
select{ |pull| pull.repo.private == false }.
^^^^^^
app/controllers/welcome_controller.rb:7:13: C: Space missing to the left of {.
select{ |pull| pull.repo.private == false }.
^
app/controllers/welcome_controller.rb:7:50: C: Place the . on the next line, together with the method name.
select{ |pull| pull.repo.private == false }.
^
app/controllers/welcome_controller.rb:8:7: C: Align first with Pull.request_reviewed. on line 4.
first(10)
^^^^^
app/decorators/membership_decorator.rb:3:1: C: Extra empty line detected at class body end.
app/decorators/pull_decorator.rb:31:26: C: Do not use Time.at without zone. Use one of Time.zone.at, Time.current, Time.at.in_time_zone, Time.at.utc, Time.at.getlocal, Time.at.iso8601, Time.at.jisx0301, Time.at.rfc3339, Time.at.to_i, Time.at.to_f instead.
sum_minutes = ((Time.at(updated_at) + 2.hours) - Time.now) / 60
^^
app/decorators/pull_decorator.rb:31:59: C: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.to_i, Time.now.to_f instead.
sum_minutes = ((Time.at(updated_at) + 2.hours) - Time.now) / 60
^^^
app/decorators/pull_decorator.rb:44:3: C: Use delegate to define delegations.
def files_changed_count
^^^
app/decorators/pull_decorator.rb:49:3: C: Use delegate to define delegations.
def commits_count
^^^
lib/github/request.rb:2:3: C: Class has too many lines. [178/100]
class Request
^^^^^
lib/github/request.rb:78:34: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
_get_credential_resource "user/orgs", :org, github_account.access_token
^^^^^^^^^^^
lib/github/request.rb:97:36: W: Literal interpolation detected.
logger.error "[Github][#{:repo_zip}] responseCode => #{res.code}"
^^^^^^^^^
lib/github/request.rb:98:36: W: Literal interpolation detected.
logger.error "[Github][#{:repo_zip}] responseMessage => #{res.message}"
^^^^^^^^^
lib/github/request.rb:99:36: W: Literal interpolation detected.
logger.error "[Github][#{:repo_zip}] subUrl => https://github.com/#{repo.full_name}/archive/master.zip"
^^^^^^^^^
lib/github/request.rb:200:9: C: Do not expand array literals in when conditions.
when *%i(review get_access_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/github/request.rb:202:9: C: Do not expand array literals in when conditions.
when *%i(issue_comment)
^^^^^^^^^^^^^^^^^^^^^^^
lib/github/request.rb:204:9: C: Do not expand array literals in when conditions.
when *%i(changed_file pull content issue commit diff org role_in_org repo_zip)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/github/request.rb:206:9: C: Do not expand array literals in when conditions.
when *%i(review_comment)
^^^^^^^^^^^^^^^^^^^^^^^^
lib/github/request.rb:214:9: C: Do not expand array literals in when conditions.
when *%i(issue_comment changed_file pull review_comment)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/github/request.rb:216:9: C: Do not expand array literals in when conditions.
when *%i(content commit issue diff review org role_in_org repo_zip)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/json_web_token.rb:6:1: C: Use 2 (not 1) spaces for indentation.
def self.encode(payload)
^
70 files inspected, 50 offenses detected
Exited with code 1
WHAT - 何を作るのか?
例. コレをアレしたらソウなるようにする
WHY - 何故作るのか?
例). KPIの新規作成
HOW - どうやって作るのか?
例). KPIの新規作成
参考URL
参考資料
添付ファイルを参照(ある場合は)