8年目のプロジェクトにRuboCopを導入した話/Introduce RuboCop In 8-year-old project

8年目のプロジェクトにRuboCopを導入した話/Introduce RuboCop In 8-year-old project

8年の歴史があるプロジェクトにRuboCopを導入した話です。

D166b6533f90f65da99c0d44a8be2a3d?s=128

Yuta Kamezezaki

May 30, 2019
Tweet

Transcript

  1. ©2019 Wantedly, Inc. Introduce RuboCop In 8-year-old project May 30,

    2019 - Yuta Kamezaki Meguro.rb #27
  2. ©2019 Wantedly, Inc. Yuta Kamezaki @ykamez About me Twitter: @ykamez_

    2 Wantedly. Inc. / Engineer 2019೥ೖࣾɻ Wantedly VisitͷάϩʔενʔϜॴଐ ෼ੳ͔ΒࢪࡦఏҊɺ࣮૷(αʔόʔ)·ͰΛ୲౰ɻ
  3. ©2019 Wantedly, Inc. 3VCP$PQΛೖΕ͍ͨਓ ಛʹɺطଘͷϓϩδΣΫτʹೖΕΔέʔε ର৅

  4. ©2019 Wantedly, Inc.  େมͩͬͨ͜ͱ  ޻෉ͨ͜͠ͱ ࠓ೔࿩͢͜ͱ ࡀͷϓϩδΣΫτʹ3VCP$PQΛಋೖ͢Δ·Ͱ

  5. ©2019 Wantedly, Inc. w ͲͷϧʔϧΛ࠾༻͢Δ͔ w ͲͷΑ͏ʹ࢖ͬͯ΋Β͏͔ w Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠ େมͩͬͨ͜ͱ

    Ұൠతͳ࿩
  6. ©2019 Wantedly, Inc. ྺ࢙͕௕ͯ͘ڊେ ೥ੜ·Ε ߦ਺: 166,566 େมͩͬͨ͜ͱ 8BOUFEMZͳΒͰ͸ͷ໰୊

  7. ©2019 Wantedly, Inc. w ೥ؒΈΜͳࣗ༝ͳελΠϧͰॻ͍͖ͯͨ w طଘίʔυͷमਖ਼͕େม w ؔ܎ऀ͕ଟ͍ˠίϯηϯαε͕औΓͮΒ͍ w

    ࠓߋײ ৺ཧతϋʔυϧ  େมͩͬͨ͜ͱ 8BOUFEMZͳΒͰ͸ͷ໰୊ ྺ࢙͕௕ͯ͘ڊେ
  8. ©2019 Wantedly, Inc. σϑΥϧτͰ૸ΒͤͯΈͨ ͲͷϧʔϧΛ࠾༻͢Δ͔

  9. ©2019 Wantedly, Inc. ͲͷϧʔϧΛ࠾༻͢Δ͔ Inspecting 4062 files 4062 files inspected,

    126547 offenses detected σϑΥϧτͷϧʔϧͷ৔߹ 126,547 offenses
  10. ©2019 Wantedly, Inc. σϑΥϧτͷϧʔϧ͸ݫͦ͠͏ ͲͷϧʔϧΛ࠾༻͢Δ͔ ϧʔϧͱݱঢ়ʹେ͖ͳဃ཭͕͋Δ

  11. ©2019 Wantedly, Inc. NFPXDPQͷϧʔϧ͕ྑ͍Β͍͠ ͲͷϧʔϧΛ࠾༻͢Δ͔ ผνʔϜͰಋೖ͓ͯ͠Γɺධ൑͕ྑ͔ͬͨ

  12. ©2019 Wantedly, Inc.  3VCP$PQͷDPOpHͷHFN https://github.com/sider/meowcop  ελΠϧͷ໰୊͸ࢦఠ͠ͳ͍ w ϓϩδΣΫτݻ༗ͷϧʔϧΛແޮԽ

    https://blog-ja.sideci.com/entry/2016/10/03/171816 NFPXDPQͱ͸ →طଘProjectʹಋೖ͠΍͍͢
  13. ©2019 Wantedly, Inc. 4062 files inspected, 12080 offenses detecte ͲͷϧʔϧΛ࠾༻͢Δ͔

    NFPXDPQͷϧʔϧͷ৔߹
  14. ©2019 Wantedly, Inc. 4062 files inspected, 12080 offenses detecte ͲͷϧʔϧΛ࠾༻͢Δ͔

    NFPXDPQͷϧʔϧͷ৔߹ 12,080 offenses
  15. ©2019 Wantedly, Inc. 4062 files inspected, 12080 offenses detecte 126,547→12,080

    ͲͷϧʔϧΛ࠾༻͢Δ͔ NFPXDPQͷϧʔϧͷ৔߹ ݱ࣮తͳဃ཭
  16. ©2019 Wantedly, Inc. ͲͷϧʔϧΛ࠾༻͢Δ͔ w ͲͷΑ͏ʹ࢖ͬͯ΋Β͏͔ w Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠ େมͩͬͨ͜ͱ ✅

  17. ©2019 Wantedly, Inc. ୭΋࢖Θͳ͔ͬͨΒҙຯ͕ͳ͍ ͲͷΑ͏ʹ࢖ͬͯ΋Β͏͔ ڧ੍ྗ͕ͳ͍΋ͷ͸ܗ֚Խ͕ͪ͠

  18. ©2019 Wantedly, Inc. ͲͷΑ͏ʹ࢖ͬͯ΋Β͏͔ +

  19. ©2019 Wantedly, Inc. 1. reviewdog  3VCP$PQͷ݁ՌΛ13ʹίϝϯτͯ͘͠ΕΔ IUUQTHJUIVCDPNSFWJFXEPHSFWJFXEPH 2. Travis

    CI  $*αʔϏεͰࣗಈνΣοΫ ͲͷΑ͏ʹ࢖ͬͯ΋Β͏͔ ˠΏΔΊͷӡ༻ࣗಈԽ $*͸མͱ͞ͳ͍
  20. ©2019 Wantedly, Inc. ͲͷϧʔϧΛ࠾༻͢Δ͔ ✅ͲͷΑ͏ʹ࢖ͬͯ΋Β͏͔ w Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠ େมͩͬͨ͜ͱ ✅

  21. ©2019 Wantedly, Inc. w طଘͷίʔυͷѻ͍ w ϧʔϧऔࣺબ୒ͷϓϩηε Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠

  22. ©2019 Wantedly, Inc. طଘͷίʔυͷѻ͍ Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠ ϧʔϧΛద༻ͨ͠Βɺطଘͷ$PEF΋मਖ਼ɻ ϧʔϧͱ$PEFͷဃ཭Λ๷͙ɻ

  23. ©2019 Wantedly, Inc. ϧʔϧऔࣺબ୒ͷϓϩηε Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠ JTTVFͰٞ࿦ˠϧʔϧ֬ఆˠ൓ө JTTVFͰΦʔϓϯʹٞ࿦͠ɺೲಘײΛ࣋ͨͤΔɻ

  24. ©2019 Wantedly, Inc. ϧʔϧऔࣺબ୒ͷϓϩηε Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠

  25. ©2019 Wantedly, Inc. JTTVFͰΦʔϓϯʹٞ࿦͠ɺೲಘײΛ࣋ͨͤΔɻ ϧʔϧऔࣺબ୒ͷϓϩηε Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠ JTTVFͰٞ࿦ˠϧʔϧ֬ఆˠ൓ө

  26. ©2019 Wantedly, Inc. ͲͷϧʔϧΛ࠾༻͢Δ͔ ✅ͲͷΑ͏ʹ࢖ͬͯ΋Β͏͔ ✅Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠FUD େมͩͬͨ͜ͱ ✅

  27. ©2019 Wantedly, Inc. ՝୊ େมͩͬͨ͜ͱ޻෉ͨ͜͠ͱ ํ๏ •ؔ܎ऀͷଟ͞ •ڊେ͞ •8೥ͷྺ࢙ •ΏΔ͍ϧʔϧͰελʔτ

    •CIͰࣗಈԽ(ڧ੍͸͠ͳ͍) •Φʔϓϯͳٞ࿦ •ӡ༻ํ਑ͷ໌֬Խ • ͲͷϧʔϧΛ࠾༻͢Δ͔ • ͲͷΑ͏ʹ࢖ͬͯ΋Β͏͔ • Ͳ͏͍͏ํ਑Ͱӡ༻͍͔ͯ͘͠ Ұൠతͳ໰୊ Wantedlyݻ༗ͷ໰୊
  28. ©2019 Wantedly, Inc. ແࣄ3VCP$PQಋೖ ೥ӽ͠ͷಋೖ

  29. ©2019 Wantedly, Inc. ྑ͍఺ • ϨϏϡʔલʹϛεʹؾ͕͚ͭͨɻ ՝୊ • ϧʔϧͷऔࣺબ୒͕೉͍͠ɻ •

    ϧʔϧΛܾΊΔϓϩηε͕ᐆດɻ ൓Ԡ
  30. ©2019 Wantedly, Inc.  ϧʔϧऔࣺબ୒ͷϓϩηεޮ཰Խ • ೲಘײͷ͋ΔϧʔϧΛͲ͏ૉૣܾ͘Ί͍͔ͯ͘  ͲΕ͘Β͍ݫ͍͠ӡ༻ʹ͢Δ͔ •

    CI͸མͱ͢ͷ͔  ࣾ಺ͷϧʔϧڞ௨Խ ϚΠΫϩαʔϏε  ࢒Δ՝୊ ˠ·ͩ·ͩࢼߦࡨޡத
  31. ©2019 Wantedly, Inc.  ೥໨ͷϓϩδΣΫτͰ΋ಋೖͰ͖Δ • ઍཬͷಓ΋Ұา͔Β  ΏΔ࢝͘ΊͯΈΑ͏ ·ͱΊ

  32. ©2019 Wantedly, Inc. Thank you