magic-comment-magic.pdf

 magic-comment-magic.pdf

023b04c98f39cc041293d780352432ff?s=128

Koichi ITO

July 18, 2019
Tweet

Transcript

  1.  -PT"OHFMFT

  2.  -PT"OHFMFT

  3.  -PT"OHFMFT ⏰⚡ 5JNFPVU

  4. *GJUEPFTOPUUJNFEPVU

  5.  8FE Magic comment magic ,PJDIJ*50&4. JOD 3VCZ$POG 5IF.JMMFOOJVN#JMUNPSF-PT"OHFMFT My

    memorial RuboCop’s issue 2018
  6.  5IV Magic comment magic ,PJDIJ*50&4. JOD )FJTFJSC 4IJCVZB +BQBO

    My memorial RuboCop’s issue 2018 Reiwa edition
  7. !LPJD w *DPNFGSPN5PLZP +BQBO w *`NXPSLJOHJO&4. JOD w 3VCP$PQDPNNJUUFS w

    "30SBDMFFOIBODFE BEBQUFSDPNNJUUFS w 3VCZ,BJHJTQFBLFS w 3VCZ,BJHJ-5FS
  8. "TJNJMBSOPUBUJPOT Ӭ࿨ &JXB4ZTUFN.BOBHFNFOU *OD ྩ࿨ 3FJXB

  9. "TJNJMBSOPUBUJPOT Ӭ࿨ &JXB4ZTUFN.BOBHFNFOU *OD /eiwa/i.match?('Eiwa') #=> true ྩ࿨ 3FJXB

  10. "TJNJMBSOPUBUJPOT Ӭ࿨ &JXB4ZTUFN.BOBHFNFOU *OD /eiwa/i.match?('Eiwa') #=> true ྩ࿨ 3FJXB /eiwa/i.match?('Reiwa')

    #=> true
  11. *DPNFGSPNFJXB

  12. 044

  13. Support coexistence with OSS community

  14. None
  15. 5IJTJTUIF3VCP$PQDPOUSJCVUPSTSBOLJOHUIJTZFBS

  16. 5IJTJTUIF3VCP$PQDPOUSJCVUPSTSBOLJOHUIJTZFBS *U`TNF

  17. *XJMMUBMLBCPVU lNBHJDDPNNFOUz XJUI3VCP$PQ UIJTQSFTFOUBUJPO

  18. 3VCZIBTUXPNBKPS NBHJDDPNNFOUGFBUVSFT

  19. 3VCZIBTUXPNBKPS NBHJDDPNNFOUGFBUVSFT w&ODPEJOHNBHJD DPNNFOU

  20. 3VCZIBTUXPNBKPS NBHJDDPNNFOUGFBUVSFT w&ODPEJOHNBHJD DPNNFOU w'SP[FOTUSJOHMJUFSBM NBHJDDPNNFOU

  21. &ODPEJOHNBHJDDPNNFOU # encoding: 'utf-8' # encoding: 'ascii'

  22. &ODPEJOHNBHJDDPNNFOU w5IJTNBHJDDPNNFOUNBLFTpMF FODPEJOHTQFDJpFECZFODPEJOH w*OUSPEVDFEGSPN3VCZ w4DSJQUFODPEJOHJT65'CZ EFGBVMUGSPN3VCZ w5IVTUIJTNBHJDDPNNFOUJT VOOFFEFEBMNPTUDBTFTDVSSFOUMZ

  23. # frozen_string_literal: true # frozen_string_literal: false 'SP[FOTUSJOHNBHJDDPNNFOU

  24. 'SP[FOTUSJOHNBHJDDPNNFOU w5IJTNBHJDDPNNFOUNBLFTGSP[FO TUSJOHMJUFSBMXIFUIFSPSOPU w*OUSPEVDFEGSPN3VCZ w3VCZPO3BJMTGSBNFXPSLDPEFT JOUSPEVDFEJUGSPN3BJMT w0OUIFPUIFSIBOE3BJMT HFOFSBUPSTEPFTOPUJODMVEFEJU

  25. 5IFSFJTBDPQ SFMBUFEUPUIFTF NBHJDDPNNFOUT

  26. SVCPDPQIRSVCPDPQ 'FBUVSF3FRVFTU8BSOJOWBMJEMPDBUJPOPG DPEJOHQSBHNB

  27. 5IJTJTBGFBUVSFSFRVFTUUP3VCP$PQ

  28. SVCPDPQIRSVCPDPQ <'JY>"EEOFXA-JOU0SEFSFE.BHJD$PNNFOUTADPQ

  29. 5IJTQVMMSFRVFTUIBTJNQMFNFOUFEUIFGFBUVSF

  30. "CPVUGFBUVSF w5IJTDPQDIFDLTDPEJOH NBHJDDPNNFOUTIPVMECF pSTUMJOF PSOFYUPGTIFCBOH
 
 
 


  31. "CPVUGFBUVSF w5IJTDPQDIFDLTDPEJOH NBHJDDPNNFOUTIPVMECF pSTUMJOF PSOFYUPGTIFCBOH w5IFOFYUTMJEFFYBNQMF FYQFDUFEUPGSP[FOTUSJOH BOE65'FODPEJOH

  32. #BEPSEFS # frozen_string_literal: true # encoding: ascii p [''.frozen?, ''.encoding]

    #=> [true, #<Encoding:UTF-8>] *UFYQFDUFE"4$**FODPEJOHCVUBDUVBMMZ65'FODPEJOH
  33. (PPEPSEFS # encoding: ascii # frozen_string_literal: true p [''.frozen?, ''.encoding]

    #=> [true, #<Encoding:US-ASCII>]
  34. (PPEPSEFS #!/usr/bin/env ruby # encoding: ascii # frozen_string_literal: true p

    [''.frozen?, ''.encoding] #=> [true, #<Encoding:US-ASCII>]
  35. 1SFWJPVTMZ  UIJTDPQIBE BQSPCMFN

  36. SVCPDPQIRSVCPDPQ -JOU0SEFSFE.BHJD$PNNFOUTSFQPSUTBUMJOFJTOPU BNBHJDDPNNFOU

  37. *UXBTBCVHSFQPSUGSPNNZ3VCZGSJFOE

  38. 5IJTJTBWBMJEDPEF # frozen_string_literal: true x = { encoding: Encoding::SJIS }

    puts x
  39. "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.
  40. SVCPDPQIRSVCPDPQ <'JY>'JYBGBMTFQPTJUJWFGPS A-JOU0SEFSFE.BHJD$PNNFOUTA

  41. *PQFOFEBQVMMSFRVFTUUPpYJU

  42. 5IJTJTUIFDPSFPGUIF QBUDI

  43. 5IFSFXBTBGBMTFQPTJUJWF UPNJTVOEFSTUBOEJOHUIF )BTIOPUBUJPOBTBO FODPEJOHNBHJDDPNNFOU

  44. "TJNJMBSOPUBUJPOT

  45. "TJNJMBSOPUBUJPOT .BHJDDPNNFOU # encoding: ascii

  46. "TJNJMBSOPUBUJPOT .BHJDDPNNFOU # encoding: ascii )BTI x = { encoding:

    Encoding::SJIS }
  47. "TJNJMBSOPUBUJPOT .BHJDDPNNFOU # encoding: ascii )BTI x = { encoding:

    Encoding::SJIS } ^^^^^^^^^^^^^^^^^^^^^^^^
  48. "TJNJMBSOPUBUJPOT .BHJDDPNNFOU # encoding: ascii ^^^^^^^^^^^^^^^ )BTI x = {

    encoding: Encoding::SJIS } ^^^^^^^^^^^^^^^^^^^^^^^^
  49. "TJNJMBSOPUBUJPOT # encoding: ascii ^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^

  50. "TJNJMBSOPUBUJPOT encoding: ascii ^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^

  51. )PXEPZPVMPPLTUIJT encoding: ascii ^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^

  52. 5IJTQBUDIDIBOHFTUIF QBUUFSONBUDIPGUIF FODPEJOHNBHJDDPNNFOU UIBUCFHJOOJOHPGMJOF BMXBZTTUBSUTXJUIAA

  53. 5IFNBHJDDPNNFOUMJOF BMXBZTTUBSUTXJUIAA encoding: ascii ^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^

  54. 5IFNBHJDDPNNFOUMJOF BMXBZTTUBSUTXJUIAA # encoding: ascii ^^^^^^^^^^^^^^^^^ encoding: Encoding::SJIS ^^^^^^^^^^^^^^^^^^^^^^^^

  55. 5IJTXBTBGVOOZCVH

  56. 4P ZPVDBOPQFO BOJTTVFPSB13 BMXBZT JGZPVpOEBCVHPS BOJTTVF

  57. :PVSJTTVFNBZCF BOZPOFTJTTVF

  58. 4FFZPVTPDJBMDPEJOH DPNNVOJUZXPSME XJUI3VCZ

  59. l /PXBZUPMJNJUPVS HPBMT8FMMpOEB SFBTPOUPCFMJFWF 'BDJOH/PWB&SB /PWB&SB