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
Beyond the RuboCop Defaults
koic
3
2.7k
Minify Ruby Code
koic
2
2.1k
Permanent Agility
koic
37
7.5k
RuboCop: LSP and Prism
koic
3
4.1k
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
The Resurrection of the Fast Parallel Test Runner
koic
1
6.2k
Other Decks in Programming
See All in Programming
初めてDefinitelyTypedにPRを出した話
syumai
0
400
CSC509 Lecture 11
javiergs
PRO
0
180
Jakarta EE meets AI
ivargrimstad
0
600
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
cmp.Or に感動した
otakakot
1
120
距離関数を極める! / SESSIONS 2024
gam0022
0
280
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
Contemporary Test Cases
maaretp
0
130
Ethereum_.pdf
nekomatu
0
460
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
32
1.5k
Become a Pro
speakerdeck
PRO
25
5k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Visualization
eitanlees
145
15k
Raft: Consensus for Rubyists
vanstee
136
6.6k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Writing Fast Ruby
sferik
627
61k
Designing the Hi-DPI Web
ddemaree
280
34k
Building Your Own Lightsaber
phodgson
103
6.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
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