Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
rubocop-headquarters-2018.pdf
Search
Koichi ITO
July 14, 2018
Programming
3
5.6k
rubocop-headquarters-2018.pdf
Rails Developers Meetup 2018 Day 3 Extreme (
https://techplay.jp/event/679666
)
Koichi ITO
July 14, 2018
Tweet
Share
More Decks by Koichi ITO
See All by Koichi ITO
Carving the Way to Ruby Engineering
koic
3
510
Beyond the RuboCop Defaults
koic
3
3.1k
Minify Ruby Code
koic
2
2.2k
Permanent Agility
koic
37
7.7k
RuboCop: LSP and Prism
koic
3
4.2k
Organizational Pattern Hatching
koic
0
1.5k
A Practitioner's Journey from Ruby 1.8 to Present
koic
1
2k
A Story Featuring Right Hand Archetype
koic
0
1.1k
Without Practice, No Emergence
koic
4
2.4k
Other Decks in Programming
See All in Programming
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
120
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
180
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
210
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
190
ドメインイベント増えすぎ問題
h0r15h0
2
480
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
1
300
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
240
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.1k
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
310
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
160
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
190
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
180
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Cult of Friendly URLs
andyhume
78
6.1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
171
50k
Bash Introduction
62gerente
609
210k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Agile that works and the tools we love
rasmusluckow
328
21k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Transcript
4BU 3VCP$PQ )FBERVBSUFST 3BJMT%FWFMPQFST.FFUVQ%BZ&YUSFNF %3&$0.$P -UE The road to
RuboCop 1.0 after RubyKaigi 2018 ,PJDIJ*50FTN
!LPJD w 3VCP$PQDPNNJUUFS w "30SBDMFFOIBODFE BEBQUFSDPNNJUUFS w &JXB4ZTUFN .BOBHFNFOU *OD
!FTNJOD -VODI4QPOTPS )FSF
3BJMTENBOENF
3BJMTEN
3BJMTEN
3BJMTENEBZ
3BJMTENEBZ
None
None
None
3BJMTίϛϡχςΟҭͪͷࢹ
4BU 3VCP$PQ )FBERVBSUFST 3BJMT%FWFMPQFST.FFUVQ%BZ&YUSFNF %3&$0.$P -UE The road to
RuboCop 1.0 after RubyKaigi 2018 ,PJDIJ*50FTN
ࠓͷ
IUUQTTQFBLFSEFDLDPNLBLVUBOJBHJMFNBOJGFTUPEFDBEF TMJEF !LBLVUBOJ
w"CPVU3VCP$PQ)2 w5IFSPBEUP 3VCP$PQBGUFS 3VCZ,BJHJ "HFOEB
1FPQMF 1SPEVDU
1FPQMF
w ݄ʹདྷ͍ͯͨ͠ !CCBUTPWʹΑͬͯެ։͞ΕΔ w (JU)VC্ʹࢄ͍ͯͨ͠(BOH PG3VCP$PQΛ౷ׅ͍ͯ͠Δ (JU)VCPSHBOJ[BUJPO w "OFX044DPNNVOJUZ 3VCP$PQ)FBERVBSUFST
HJUIVCDPNSVCPDPQIR
None
w 3VCP$PQ$PSF w 3VCP$PQ1FSGPSNBODF w 3VCP$PQ3BJMT w 3VCP$PQ34QFD w 3VCZ4UZMF(VJEF
w 3BJMT4UZMF(VJEF w 3VCP$PQ+1 w FUD 3VCP$PQ)2ͷSFQP
w ࢄͨ͠ෳͷݸਓϦϙδτϦ͔Β ͍ͪίϛϡχςΟͷϦϙδτϦ w ݸਓϦϙδτϦͷਓ͕ͨͪ)2ʹू ·͖ͬͯͨ 044ίϛϡχςΟͷৢ
w 3VCP$PQ$PSFΛத৺ʹؔ৺ͷ͋ Δϝϯόʔɺ3VCP$PQ34QFDΛ த৺ʹ׆ಈ͍ͯ͠Δϝϯόʔ w ͯ͢ͷϦϙδτϦʹίϛοτݖ͕͋ ΔΘ͚Ͱͳ͍ w ྫ͑ࢲ$PSF1FSGPSNBODF 3BJMT+1
ϝϯόʔ͝ͱͷྖҬͷҧ͍
w $PSFCCBUTPWSVCPDPQͩͬ ͨͷͰɺ͍ΘΏΔ3VCP$PQͱݺ Ε͍ͯΔͷͷத৺ w 3VCP$PQ34QFDͳͲ֦ு$PQ͕ ґଘ͍ͯ͠Δ֦ுݩ(FNͷଆ໘ w $PSFͰܧঝʹؔ͢ΔΠϯλϑΣʔε ͕มΘΔͱ֦ு$PQӨڹΛड͚Δ
֦ுݩ$PQͱͯ͠ͷ$PSF
w ͜͜Ұͷഁյతมߋͱͯ͠ /PEF1BUUFSOͷOJM ͷมߋ 3VCP$PQ$PQ͔Βͷ 3BOHF)FMQϞδϡʔϧΓग़͠ ͕͋Δ ֤֦ு(FNਵ͕ඞཁ w
ؔ৺ͷ͋Δϝϯόʔ͕)2ʹू·ͬ ͨͷྑ͍ ҟͳΔϓϩδΣΫτؒͰͷಉظ
w ίϯτϦϏϡʔλʹൺͯΕΔ͜ ͱ͕૿͑Δ w ίϛολʔʹͳͬͯվΊͯࢥͬͨ͜ Ε·Ͱͱ͜Ε͔Β w (JU)VCϕʔεͷ3BJMTίϛϡχ ςΟͱൺֱ )2ઃཱͱಉ࣌ʹίϛολʔʹͳͬͨ
044ίϛϡχςΟʹΑΔҧ͍ SBJMTSBJMT CCBUTPWSVCPDPQ 3FWJFX ؔ৺Λ࣋ͬͨਓ ؔ৺Λ࣋ͬͨਓ $MPTF JTTVF *TTVFνʔϜɺίϛολʔɺί Ξϝϯόʔ
ίϛολʔ .FSHF13 ίϛολʔɺίΞϝϯόʔ ΄΅ϦϙδτϦΦʔφʔ NBTUFS QVTI ίϛολʔɺίΞϝϯόʔ ϦϙδτϦΦʔφʔͷΈ ؍ଌൣғ 3FMFBTF ϦϦʔεϚωʔδϟ ϦϙδτϦΦʔφʔ
ࢲ͕ۙະདྷʹඳ͘3VCP$PQ)2ͷੈք؍ SBJMTSBJMT SVCPDPQIRSVCPDPQ 3FWJFX ؔ৺Λ࣋ͬͨਓ ؔ৺Λ࣋ͬͨਓ $MPTF JTTVF *TTVFνʔϜɺίϛολʔɺί Ξϝϯόʔ
ίϛολʔ .FSHF13 ίϛολʔɺίΞϝϯόʔ ίϛολʔ NBTUFS QVTI ίϛολʔɺίΞϝϯόʔ ίϛολʔ 3FMFBTF ϦϦʔεϚωʔδϟ ϔουϝϯςφʔ 0S
SVCPDPQIRSVCPDPQ %SPQTVQQPSUGPS.3*
w HJUQVTIPSJHJONBTUFSʹͭ ͍ͯ w جຊ1VMM3FRVFTUΛ։͘ w ໌നͳ$PTNFUJDDIBOHF NBTUFSQVTIͰྑ͍ͷͰʁ ίϛολʔͷݖརͱن
None
w ͬͯΈͤ HJUQVTIPSJHJONBTUFS git push origin master
SVCPDPQIRSVCPDPQ!GGBF 'JY$)"/(-0(NE
None
None
IUUQTUXJUUFSDPNLPJDTUBUVT
w lNBTUFSQVTI͢Δͱ͖13Λ ૹΔͱ͖ΑΓ৻ॏʹ͍ͬͯΔz w l࣌ؒʹΘΕͯΔͱ͖Βͳ͍z w l ϛεͨ͋͠ͱ NBTUFSQVTIͷ จԽΛ࡞ΔͳΒઆ໌͏·͍͜ͱ͢
Δඞཁ͕͋Δz 3BJMT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&YUSBDU3BJMT$PQTJOBTFQBSBUF &YUSBDU1FSGPSNBODF$PQTJOUPB TFQBSBUFHFN &YUFOEDPQNFUBEBUB *OUSPEVDFOFXDPQTXJUIBTQFDJBMTUBUVT JOTUFBEPGFOBCMFEEJTBCMFE
*NQMFNFOUPQUJPOTUPSVOPOMZTBGFDPQT BOETBGFBVUPDPSSFDUT #JHNJMFTUPOFUP3VCP$PQ
SVCPDPQIRSVCPDPQ &YUSBDU3BJMT$PQTJOBTFQBSBUF
None
w 3VCP$PQࣗମϑϨʔϜϫʔΫ ϥΠϒϥϦϥϯλΠϜʹґଘͤͣ 3VCZʹϑΥʔΧε͍ͨ͠ w ࡞ऀͱͯ͠ɺ͍·3BJMTΛ͋·Γ ͍ͬͯͳ͍Β͍͠ w ͨͷ·Ε·ͨ͠ 5-%3
w SVCPDPQSBJMTͱ͍͏HFN طʹଘࡏ͍ͯ͠Δ ΤίγεςϜ্ͷ՝
None
None
w SBJMTSBJMTͷSVCPDPQZNMΛө͠ ͨSEQBSUZDPQ w 3VCZ,BJHJͰCCBUTPW͞Μʹ ZBIPOEB͞Μ͕Λͯ͘͠Εͨ w 3VCZ,BJHJޙʹ%SFONJ͞ΜΒ͔Βϝ ϯγϣϯ͕͋Δ w
13Λૹ͍ͬͯͨࢲʹҾ͖ܧ͗ ྲྀΕ
None
None
None
None
!UPTIJNBSV͞Μ͋Γ͕ͱ͏͍͟͝·͢ʂ
w 3VCP$PQͷ3BJMT෦ॺʹ͍ͭͯ ελϒʹͯ͠ɺSVCPDPQSBJMT HFNͷՃΛଅ͢ϩάΛग़ྗ͢Δ w ͋Δ͍3VCP$PQ3BJMTʹ ϑΥʔϧόοΫ͢Δ 3VCP$PQ3BJMTͷҠߦ
SVCPDPQIRSVCPDPQ &YUSBDU1FSGPSNBODF$PQTJOUPBTFQBSBUFHFN
None
w ύϑΥʔϚϯεޮʹ͍ͭͯ.3* ʹಛԽͨ͠༰ʹͳ͍ͬͯΔ w 3VCP$PQ+3VCZαϙʔτ ͍ͯ͠Δ w 3VCP$PQ$PSFͱͯ͠ॲཧܥ ʹґଘ͠ͳ͍ܗΛࢦ͍ͯ͠Δ 5-%3
None
w ࣮ࡍͷޮՌʹ͍ͭͯɺެࣜυΩϡ ϝϯτͷϦϑΝϨϯεʹه͞Ε͍ͯ Δ߹͕͋Δ w ࠾ΛΜͩ࣌Ұಡ͔ͯ͠Β࣮ߦ ΛࢼΈͯྑͦ͞͏ 5JQTPG1FSGPSNBODFDPQ
1FSGPSNBODF4BNQMF
+VBOJUP'BUBTGBTUSVCZ
SBJMTSBJMT
CFODINBSLJQT
$PNQBSJTPO % ruby -v shuffle-first-vs-sample.rb ruby 2.5.1p57 (2018-03-29 revision 63029)
[x86_64- darwin17] Warming up -------------------------------------- Array#shuffle.first 35.171k i/100ms Array#sample 229.945k i/100ms Calculating ------------------------------------- Array#shuffle.first 400.180k (± 5.9%) i/s - 2.005M in 5.026934s Array#sample 6.407M (± 6.4%) i/s - 31.962M in 5.010117s Comparison: Array#sample: 6407183.3 i/s Array#shuffle.first: 400180.2 i/s - 16.01x slower
w !DPNQPTFSJOUFSBMJB͕ਐΊͯ ͘Ε͍ͯΔ w 3VCP$PQʹ͚ͯ 3VCP$PQ3BJMTಉ༷ਐḿ͍ͯ͠Δ w ͠Β͘3VCP$PQ$PSFͱͷಉ ظ͕৬ਓͷԹ͔ͳख࡞ۀ 1FSGPSNBODFDPQTͷநग़ঢ়گ
SVCPDPQIRSVCPDPQ &YUFOEDPQNFUBEBUB
None
w ͓ͦΒ͘3VCP$PQͷۄ w 3VCP$PQΛΞοϓάϨʔυͨ͠ࡍʹ ރΕ͍ͯͳ͍$PQͰͷ͕͋ͬͨΓ CSFBLJOHDIBOHFͨ͠Γͷ൵͠Έ ͷ͓ศΓͷػೳ w SVCPDPQZNM EFGBVMUZNM
ͷ ϝλσʔλͷՃ 5-%3
w 7FSTJPO"EEFEʜ$PQ͕Ճ͞Εͨόʔδϣ ϯ w 7FSTJPO$IBOHFEʜϢʔβʔʹӨڹͷ͋Δόʔ δϣϯ ৽͍͠ઃఆɺσϑΥϧτͷมߋ w 7FSTJPO3FNPWFEʜআ͞Εͨόʔδϣϯ
w 4BGFʜِཅੑͳͲͳ͘ઃܭͲ͓Γʹ৴པͰ͖Δ w 4BGF"VUP$PSSFDUʜࣗಈमਖ਼ͰյΕ͍ͯͳ͍ ͭͷϝλσʔλ
w 4BGFΦϓγϣϯͷΈ࣮ߦ͢Δ w 4BGF"VUP$PSSFDUͷΈ࣮ߦ͢Δ w σϑΥϧτͰͯ͢4BGFѻ͍ w ࠷৽όʔδϣϯͷ$PQΛআ֎ͯ͠ ࣮ߦ͢Δ ࣮ߦΦϓγϣϯͷީิ
w 4BGFͱ4BGF"VUP$PSSFDUͷ ఆʹ͍ͭͯͲ͏͢Δ͔ w طଘΠγϡʔ͕͋Δ͔͕ͻͱͭͷࢦඪ ʹͳΓͦ͏ ެ։͞Εͨ۩ମతඪຊ w ͕͋Ε3VCP$PQ$PSF͔
3VCP$PQ+1·Ͱ͓ศΓΛ ݒ೦
w HPPEpSTUJTTVFͱͯ͠ਐΜͰ ͍Δ ঢ়گ
SVCPDPQIRSVCPDPQ *OUSPEVDFOFXDPQTXJUIBTQFDJBMTUBUVT JOTUFBEPGFOBCMFEEJTBCMFE
None
w طଘͷFOBCMFEEJTBCMFE ͷ֦ுͱղऍͰ͖Δ w ৽ͨʹ/FX ͋Δ͍OJM Λ༻ҙ ͯ͠ɺͦͷͷ߹৽ͨͳ$PQ Λ͏͔Ϣʔβʔʹ༗ޮແޮΛΏ ͩͶΔܯࠂΛදࣔ͢Δ
5-%3
w ΞοϓάϨʔυ࣌ʹʹͳΔͷރ Ε͍ͯͳ͍৽͍͠$PQͷέʔε͕ଟ ͍ ϦάϨογϣϯΑΓͪ͜Β͕ଟ͍ w ϝλσʔλͷ7FSTJPO"EEFEɺ͋ Δ͍&OBCMFEͷ/FXΛݩʹͯ͠ ࠷৽ͷόʔδϣϯͰՃ͞Εͨ$PQ
Λআ֎͢ΕޡݕΛݮΒͤͦ͏ *.0ΞοϓάϨʔυͷ҆৺ͷ্
w ݱঢ়ͷ3VCP$PQͰແޮʹ͍ͨ͠ $PQEnabled: falseͱͯ͠ ରॲͰ͖Δ͕ɺԿ͔ͷҙਤ͕͋ͬͯ EJTBCMFEʹͨ͠ͷ͔ɺόʔδϣ ϯΞοϓ࣌ͷރΕ͍ͯͳ͍$PQͩ ͔Βແޮʹ͍ͯ͠Δͷ͔ͷঢ়ଶ۠ผ ͕͔ͭͳ͍ ৽ͨͳϥϕϦϯά
SVCPDPQIRSVCPDPQ *NQMFNFOUPQUJPOTUPSVOPOMZTBGFDPQT BOETBGFBVUPDPSSFDUT
None
w SVCPDPQίϚϯυͷΦϓγϣ ϯΛՃ͢Δ 5-%3
w --safeΦϓγϣϯʜ4BGFͷ$PQ ͷΈ࣮ߦ͢Δ w --safe-auto-correctΦϓγϣϯʜ 4BGF"VUP$PSSFDUͷ$PQͷΈ࣮ߦ ͢Δ w ͜ΕΒΛSVCPDPQZNMͰઃఆͰ͖ ΔΑ͏ʹ͢Δ
৽ͨͳ࣮ߦΦϓγϣϯ
QPDLF *UIJOLUIBUUIPTFBSFUIFLFZQPJOUT*EPO`UXBOU VTUPIBWFTPNFIVHFSPBENBQGPS*XBOUVT UPIBWFTPNFUIJOHUIBUXFDBOBDUVBMMZSFBDIJOB GFXNPOUIT IUUQTCMPHTJEFDJDPNJOUFSWJFXXJUICP[IJEBSCBUTPWCCGEB $BOZPVUFMMVTUIFSPBENBQPG3VCP$PQJO NPSFEFUBJMT CCBUTPW *OUFSWJFXXJUI#P[IJEBS#BUTPW
1SFTFOUFECZ4JEFS5FBN
͓ΘΓʹ
w 3BJMTͱ1FSGPSNBODF$PSF͔ Β֎ΕΔ $PSFͷϝϯςφϯεੑ w 3VCP$PQϝλσʔλΛͬͯ ҆৺͕͓͚ͦ͏ͳ$PQͱͦ͏Ͱͳ͍ $PQΛ৭͚Δ ར༻ऀͷ҆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