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
magic-comment-magic.pdf
Search
Koichi ITO
July 18, 2019
Programming
1
370
magic-comment-magic.pdf
平成.rb #6 (
https://heiseirb.connpass.com/event/138210/
)
Koichi ITO
July 18, 2019
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
為你自己學 Python
eddie
0
360
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
370
オニオンアーキテクチャを使って、 Unityと.NETでコードを共有する
soi013
0
290
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
340
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
270
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
240
Jakarta EE meets AI
ivargrimstad
0
330
Recoilを剥がしている話
kirik
5
7.5k
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
180
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
890
Оптимизируем производительность блока Казначейство
lamodatech
0
770
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
110
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Speed Design
sergeychernyshev
25
690
Typedesign – Prime Four
hannesfritz
40
2.4k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
The Language of Interfaces
destraynor
155
24k
Navigating Team Friction
lara
183
15k
Designing for Performance
lara
604
68k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Gamification - CAS2011
davidbonilla
80
5.1k
Scaling GitHub
holman
459
140k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Side Projects
sachag
452
42k
Transcript
-PT"OHFMFT
-PT"OHFMFT
-PT"OHFMFT ⏰⚡ 5JNFPVU
*GJUEPFTOPUUJNFEPVU
8FE Magic comment magic ,PJDIJ*50&4. JOD 3VCZ$POG 5IF.JMMFOOJVN#JMUNPSF-PT"OHFMFT My
memorial RuboCop’s issue 2018
5IV Magic comment magic ,PJDIJ*50&4. JOD )FJTFJSC 4IJCVZB +BQBO
My memorial RuboCop’s issue 2018 Reiwa edition
!LPJD w *DPNFGSPN5PLZP +BQBO w *`NXPSLJOHJO&4. JOD w 3VCP$PQDPNNJUUFS w
"30SBDMFFOIBODFE BEBQUFSDPNNJUUFS w 3VCZ,BJHJTQFBLFS w 3VCZ,BJHJ-5FS
"TJNJMBSOPUBUJPOT Ӭ &JXB4ZTUFN.BOBHFNFOU *OD ྩ 3FJXB
"TJNJMBSOPUBUJPOT Ӭ &JXB4ZTUFN.BOBHFNFOU *OD /eiwa/i.match?('Eiwa') #=> true ྩ 3FJXB
"TJNJMBSOPUBUJPOT Ӭ &JXB4ZTUFN.BOBHFNFOU *OD /eiwa/i.match?('Eiwa') #=> true ྩ 3FJXB /eiwa/i.match?('Reiwa')
#=> true
*DPNFGSPNFJXB
044
Support coexistence with OSS community
None
5IJTJTUIF3VCP$PQDPOUSJCVUPSTSBOLJOHUIJTZFBS
5IJTJTUIF3VCP$PQDPOUSJCVUPSTSBOLJOHUIJTZFBS *U`TNF
*XJMMUBMLBCPVU lNBHJDDPNNFOUz XJUI3VCP$PQ UIJTQSFTFOUBUJPO
3VCZIBTUXPNBKPS NBHJDDPNNFOUGFBUVSFT
3VCZIBTUXPNBKPS NBHJDDPNNFOUGFBUVSFT w&ODPEJOHNBHJD DPNNFOU
3VCZIBTUXPNBKPS NBHJDDPNNFOUGFBUVSFT w&ODPEJOHNBHJD DPNNFOU w'SP[FOTUSJOHMJUFSBM NBHJDDPNNFOU
&ODPEJOHNBHJDDPNNFOU # encoding: 'utf-8' # encoding: 'ascii'
&ODPEJOHNBHJDDPNNFOU w5IJTNBHJDDPNNFOUNBLFTpMF FODPEJOHTQFDJpFECZFODPEJOH w*OUSPEVDFEGSPN3VCZ w4DSJQUFODPEJOHJT65'CZ EFGBVMUGSPN3VCZ w5IVTUIJTNBHJDDPNNFOUJT VOOFFEFEBMNPTUDBTFTDVSSFOUMZ
# frozen_string_literal: true # frozen_string_literal: false 'SP[FOTUSJOHNBHJDDPNNFOU
'SP[FOTUSJOHNBHJDDPNNFOU w5IJTNBHJDDPNNFOUNBLFTGSP[FO TUSJOHMJUFSBMXIFUIFSPSOPU w*OUSPEVDFEGSPN3VCZ w3VCZPO3BJMTGSBNFXPSLDPEFT JOUSPEVDFEJUGSPN3BJMT w0OUIFPUIFSIBOE3BJMT HFOFSBUPSTEPFTOPUJODMVEFEJU
5IFSFJTBDPQ SFMBUFEUPUIFTF NBHJDDPNNFOUT
SVCPDPQIRSVCPDPQ 'FBUVSF3FRVFTU8BSOJOWBMJEMPDBUJPOPG DPEJOHQSBHNB
5IJTJTBGFBUVSFSFRVFTUUP3VCP$PQ
SVCPDPQIRSVCPDPQ <'JY>"EEOFXA-JOU0SEFSFE.BHJD$PNNFOUTADPQ
5IJTQVMMSFRVFTUIBTJNQMFNFOUFEUIFGFBUVSF
"CPVUGFBUVSF w5IJTDPQDIFDLTDPEJOH NBHJDDPNNFOUTIPVMECF pSTUMJOF PSOFYUPGTIFCBOH
"CPVUGFBUVSF w5IJTDPQDIFDLTDPEJOH NBHJDDPNNFOUTIPVMECF pSTUMJOF PSOFYUPGTIFCBOH w5IFOFYUTMJEFFYBNQMF FYQFDUFEUPGSP[FOTUSJOH BOE65'FODPEJOH
#BEPSEFS # frozen_string_literal: true # encoding: ascii p [''.frozen?, ''.encoding]
#=> [true, #<Encoding:UTF-8>] *UFYQFDUFE"4$**FODPEJOHCVUBDUVBMMZ65'FODPEJOH
(PPEPSEFS # encoding: ascii # frozen_string_literal: true p [''.frozen?, ''.encoding]
#=> [true, #<Encoding:US-ASCII>]
(PPEPSEFS #!/usr/bin/env ruby # encoding: ascii # frozen_string_literal: true p
[''.frozen?, ''.encoding] #=> [true, #<Encoding:US-ASCII>]
1SFWJPVTMZ UIJTDPQIBE BQSPCMFN
SVCPDPQIRSVCPDPQ -JOU0SEFSFE.BHJD$PNNFOUTSFQPSUTBUMJOFJTOPU BNBHJDDPNNFOU
*UXBTBCVHSFQPSUGSPNNZ3VCZGSJFOE
5IJTJTBWBMJEDPEF # frozen_string_literal: true x = { encoding: Encoding::SJIS }
puts x
"OPGGFOTFPG 3VCP$PQPDDVST # frozen_string_literal: true x = { encoding: Encoding::SJIS
} puts x test.rb:3:1: W: Lint/ OrderedMagicComments: The encoding magic comment should precede all other magic comments.
SVCPDPQIRSVCPDPQ <'JY>'JYBGBMTFQPTJUJWFGPS A-JOU0SEFSFE.BHJD$PNNFOUTA
*PQFOFEBQVMMSFRVFTUUPpYJU
5IJTJTUIFDPSFPGUIF QBUDI
5IFSFXBTBGBMTFQPTJUJWF UPNJTVOEFSTUBOEJOHUIF )BTIOPUBUJPOBTBO FODPEJOHNBHJDDPNNFOU
"TJNJMBSOPUBUJPOT
"TJNJMBSOPUBUJPOT .BHJDDPNNFOU # encoding: ascii
"TJNJMBSOPUBUJPOT .BHJDDPNNFOU # encoding: ascii )BTI x = { encoding:
Encoding::SJIS }
"TJNJMBSOPUBUJPOT .BHJDDPNNFOU # encoding: ascii )BTI x = { encoding:
Encoding::SJIS } ^^^^^^^^^^^^^^^^^^^^^^^^
"TJNJMBSOPUBUJPOT .BHJDDPNNFOU # encoding: ascii ^^^^^^^^^^^^^^^ )BTI x = {
encoding: Encoding::SJIS } ^^^^^^^^^^^^^^^^^^^^^^^^
"TJNJMBSOPUBUJPOT # encoding: ascii ^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^
"TJNJMBSOPUBUJPOT encoding: ascii ^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^
)PXEPZPVMPPLTUIJT encoding: ascii ^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^
5IJTQBUDIDIBOHFTUIF QBUUFSONBUDIPGUIF FODPEJOHNBHJDDPNNFOU UIBUCFHJOOJOHPGMJOF BMXBZTTUBSUTXJUIAA
5IFNBHJDDPNNFOUMJOF BMXBZTTUBSUTXJUIAA encoding: ascii ^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^
5IFNBHJDDPNNFOUMJOF BMXBZTTUBSUTXJUIAA # encoding: ascii ^^^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^
5IJTXBTBGVOOZCVH
4P ZPVDBOPQFO BOJTTVFPSB13 BMXBZT JGZPVpOEBCVHPS BOJTTVF
:PVSJTTVFNBZCF BOZPOFTJTTVF
4FFZPVTPDJBMDPEJOH DPNNVOJUZXPSME XJUI3VCZ
l /PXBZUPMJNJUPVS HPBMT8FMMpOEB SFBTPOUPCFMJFWF 'BDJOH/PWB&SB /PWB&SB