LoginSignup
0
0

More than 3 years have passed since last update.

プルリクエストがExcute Checkに引っかかって通らない!

Last updated at Posted at 2020-08-16

開発環境

rails 6.0.0
GitHub

本題

GitHubにプルリクエストを出した後にWorkflow.fileにのっとりCheckをかけると弾かれる
All checks have failed
1failing check

4a21b9ec1271c10658b8e185487c5bc4.png

Detailsで詳細を確認するとExecute checkでひっかかってるっぽい
Execute check
Post Cache node packages
Post Cache gems0s

05ce86ff797b43ab62235b98860279e7.png

とりあえず右上からraw logsを確認してみる

2020-08-16T09:42:13.5299688Z For more information: https://docs.rubocop.org/rubocop/versioning.html
2020-08-16T09:42:14.6852790Z Inspecting 41 files
2020-08-16T09:42:14.6852963Z .......................................C.
2020-08-16T09:42:14.6853056Z 
2020-08-16T09:42:14.6853173Z Offenses:
2020-08-16T09:42:14.6853248Z 
2020-08-16T09:42:14.6853398Z spec/requests/users_spec.rb:4:1: C: Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.
2020-08-16T09:42:14.6853569Z spec/requests/users_spec.rb:5:1: C: Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.
2020-08-16T09:42:14.6853724Z     let(:user){User.create(name: "abc", email: "abc@abc.com")}
2020-08-16T09:42:14.6853840Z ^^^^
2020-08-16T09:42:14.6853976Z spec/requests/users_spec.rb:5:15: C: Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
2020-08-16T09:42:14.6854124Z     let(:user){User.create(name: "abc", email: "abc@abc.com")}
この下にもさらに続きます・・・

こちらは別のプルリクエストの正しく動作している時のログ

2020-08-16T10:07:33.5081076Z For more information: https://docs.rubocop.org/rubocop/versioning.html
2020-08-16T10:07:34.4971235Z Inspecting 41 files
2020-08-16T10:07:34.4971682Z .........................................
2020-08-16T10:07:34.4972124Z 
2020-08-16T10:07:34.4972412Z 41 files inspected, no offenses detected
2020-08-16T10:07:37.8444334Z Created database 'zsksample_test'
2020-08-16T10:07:38.1426316Z yarn install v1.22.4
2020-08-16T10:07:38.2371503Z [1/4] Resolving packages...
2020-08-16T10:07:38.7254543Z [2/4] Fetching packages...
2020-08-16T10:07:50.0729245Z info fsevents@2.1.3: The platform "linux" is incompatible with this module.
2020-08-16T10:07:50.0730032Z info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-08-16T10:07:50.0754139Z info fsevents@1.2.13: The platform "linux" is incompatible with this module.
2020-08-16T10:07:50.0754778Z info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-08-16T10:07:50.0807608Z [3/4] Linking dependencies...
この下にさらに続きます・・・

違いと言えばoffenses:の表記
offensesってなんだよと調べてみると

違反、反則、(軽微な)犯罪、気を悪くすること、立腹、人の感情を害すること、
無礼、侮辱、気を悪くさせるもの、不愉快なもの
https://ejje.weblio.jp/content/offense

なにかしら違反してる?っぽい
そしてその原因はrubocopというGemということがわかった。

解決方法

下記の記事を参考にコーディング規約にのっとり書き換え。

https://qiita.com/betti/items/9fa4155756f1afcdb378
https://qiita.com/yokoyan/items/76e6b330a6b9d908d6fb

見事Checkが通りました。

0e638f7d0970f2bb32318524e956c4ae.png

最後に

今回初めてのチーム開発だったのでrubocopやそもそものCheckの意味合いも
わからず原因追及までかなり時間がかかりました。いい勉強になりました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0