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
Enter the OSS world [RuboCop] II. lost boundary
Search
Koichi ITO
December 09, 2017
Programming
1
2.4k
Enter the OSS world [RuboCop] II. lost boundary
Rails Developers Meetup 2017
https://railsdm.github.io/2017/
Koichi ITO
December 09, 2017
Tweet
Share
More Decks by Koichi ITO
See All by Koichi ITO
Carving the Way to Ruby Engineering
koic
3
670
Beyond the RuboCop Defaults
koic
3
3.4k
Minify Ruby Code
koic
2
2.2k
Permanent Agility
koic
37
7.8k
RuboCop: LSP and Prism
koic
3
4.3k
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
php-conference-japan-2024
tasuku43
0
430
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
390
functionalなアプローチで動的要素を排除する
ryopeko
1
190
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
300
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
1.4k
AppRouterを用いた大規模サービス開発におけるディレクトリ構成の変遷と問題点
eiganken
1
440
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
1k
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
300
Swiftコンパイラ超入門+async関数の仕組み
shiz
0
170
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
140
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
170
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
560
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
9k
Agile that works and the tools we love
rasmusluckow
328
21k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
A Tale of Four Properties
chriscoyier
157
23k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
GraphQLとの向き合い方2022年版
quramy
44
13k
Why Our Code Smells
bkeepers
PRO
335
57k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Done Done
chrislema
182
16k
Transcript
&OUFSUIF044XPSME <3VCP$PQ> **MPTUCPVOEBSZ &OUFSUIF044XPSME <3VCP$PQ> **MPTUCPVOEBSZ &OUFSUIF044XPSME <3VCP$PQ> **MPTUCPVOEBSZ &OUFSUIF044XPSME
<3VCP$PQ> **MPTUCPVOEBSZ &OUFSUIF044XPSME <3VCP$PQ> **MPTUCPVOEBSZ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ
None
None
8FMDPNFGFFECBDL (FNpMF HJU@TPVSDF HJUIVC \cSFQPcIUUQTHJUIVCDPN\SFQP^HJU^ ! HFNSBJMT HJUIVCSBJMTSBJMT HFNBDUJWFSFDPSEPSBDMF@FOIBODFEBEBQUFS HJUIVCbSTJNPSBDMF
FOIBODFE Preparing for upgrade to Rails 5.2 uses master branch instead of beta.
None
None
0DUPCFS 3VCP$PQSFMFBTFE
None
ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ &QJTPEFT 1BSU* 1BSU** 1BSU*** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ
&QJTPEFT 1BSU* ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ 1BSU** 1BSU*** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ
Enter the OSS world RuboCop I. presage comment
1SFNPOJUJPO
"3BJMTBQQMJDBUJPO EFWFMPQNFOU
3FWJFXDPNNFOU
ࣗͨͪͷࢦఠͨ͜͠ͱ ଞͷػձͰࢦఠ͞Ε͏Δ
None
044 ใԽٕज़Λ௨ͯ͡ʜ 3JEFPO044
IUUQTUXJUUFSDPNPOLTUBUVT
&QJTPEFT 1BSU* ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ 1BSU** 1BSU*** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ
ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ &QJTPEFT 1BSU* 1BSU** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ 1BSU***
Enter the OSS world RuboCop II. lost boundary
044ʹͦΕͳΓʹ͋Γɺ ΞϓϦέʔγϣϯ͔Βܨ͕͍ͬͯ ΔҎ্ɺଞਓࣄͷίʔυͰͳ͍ 3JEFPO044
ؔΘΓํͷελΠϧྫ w۩ମతʹࠔ͍ͬͯΔ w͓͠Ζͦ͏ wແཧ͠ͳ͍ όʔϯΞτ͠ͳ͍Α͏τϦΞʔδ͢Δ
$MJDLlCVHzMBCFM
3BJMT).PS)0%FQFOEFOU
8IBUJTUIJT$PQ
CCBUTPWSVCPDPQ <'JY>'JYA3BJMT)BT.BOZ0S)BT0OF%FQFOEFOUA JODPSSFDUMZqBHTAXJUI@PQUJPOTACMPDLT
8SJUFSFQSPEVDUJPOTQFDT DPOUFYUXJUI@PQUJPOTEFQFOEFOUEFTUSPZEP JUEPFTOPUSFHJTUFSBOP⒎FOTFEP FYQFDU@OP@P⒎FOTFT 36#:TUSJQ@JOEFOU DMBTT1FSTPO XJUI@PQUJPOTEFQFOEFOUEFTUSPZEP IBT@POFGPP FOE
FOE 36#: FOE FOE # Goal: False positive don't occur below ! class Person with_options dependent: :destroy do has_one :foo end end
XJUI@PQUJPOTPG"45 SVCZQBSTFFXJUI@PQUJPOTEFQFOEFOUEFTUSPZEPcBTTPDc BTTPDIBT@POFGPPFOE` ! CMPDL TFOEOJMXJUI@PQUJPOT IBTI
QBJS TZNEFQFOEFOU TZNEFTUSPZ BSHT QSPDBSHBTTPD TFOE MWBSBTTPD IBT@POF TZNGPP
XJUI@PQUJPOTPG"45 QPXFSFECZIUUQTHJUIVCDPNLPJDSVCZ@BTU@WJTVBMJ[FS
*NQMFNFOUBUJPO 3FE (SFFO 3FGBDUPS 5FTUDPEFJTNPSFPCWJPVTBOEFBTJFSUP VOEFSTUBOEUIBOUIFPQFSBUJPOPG"45
0QFOB13
$POWFSTBUJPO AJT@IBT@NBOZ@PS@IBT@POF@XJUIPVU@PQUJPOT AJT BOFYJTUJOHNFUIPEOBNF
"CPVU/BNJOH1SFEJDBUF/BNF
EFG@OPEF@NBUDIFS EFG@OPEF@NBUDIFSJT@YYY 1"55&3/ TFOEOJM \IBT@NBOZIBT@POF^@ 1"55&3/ def_node_matcher dynamic
defines a method which applies a pattern to an AST node. /PUF/BNJOH1SFEJDBUF/BNFDPQEPFTOPUBXBSFPG EZOBNJDBMMZEFpOFENFUIPEPSMPXFS -JLFEFpOF@NFUIPE EFpOF@TJOHMFHPO@NFUIPE
$POWFSTBUJPO
"OUJGBU13
ผͱͯ͠Γग़ͤΔ Α͏Ͱ͋Εผͷ13Ͱ ରॲ͢ΔΑ͏ʹ͍ͯ͠Δ ͱͱજΜͰ͍ͨͱͷରቂ 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ͷίʔυܨ͕ΓͰ͋Δ &OUFSUIF044XPSME w Πϯλʔωοτͱ͍͏ڥքͷͳ͍ ੈքͰΓͱΓ͢Δ͓͠Ζ͞ w ࠷ॳͷҰา͕͚͠Ε044(BUF
ͳͲͷࢀՃ͔Β࢝ΊΔͷҰͭ ·ͱΊ
࣍ճ༧ࠂ
ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ &QJTPEFT 1BSU* 1BSU** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ 1BSU***
ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ &QJTPEFT 1BSU* 1BSU** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ 1BSU***
&OUFSUIF044XPSME <3VCP$PQ> *** &OUFSUIF044XPSME <3VCP$PQ> *** &OUFSUIF044XPSME <3VCP$PQ> ***
l Ұͷ͏ͪίʔυॻ͖ɺ 3VCZ,BJHJͳͲͷΓؒ Ͱ։ൃऀͨͪͱͦͷΛ͢Δ ʔ3VCZ,BJHJ1BSUZΑΓ
FOE