Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Make RuboCop Super Fast

Koichi ITO
September 09, 2022

Make RuboCop Super Fast

Koichi ITO

September 09, 2022
Tweet

More Decks by Koichi ITO

Other Decks in Programming

Transcript

  1. .BLF3VCP$PQ 4VQFS'BTU ,PJDIJ*50&4. *OD 3VCZ,BJHJ RuboCop server mode  5IV

  2. !LPJD w 044QSPHSBNNFS w 3VCP$PQDPSFUFBN TJODF  w )FBENBJOUBJOFSPG3VCP$PQ3BJMT 

    3VCP$PQ1FSGPSNBODF BOE 3VCP$PQ.JOJUFTU w &OHJOFFSJOH.BOBHFSBOE %JTUJOHVJTIFE&OHJOFFSPG&4. *OD
  3. &4. *OD

  4. 🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊🌊 *TFFCJ4QPOTPS #esm_ise_ebi #rubykaigi

  5. Support OSS community

  6. 4QFBLFSTGSPN&4. *OD 👈%BZ SVCZLBJHJ# %BZ👉 SVCZLBJHJ# 👈%BZ SVCZLBJHJ#

  7. +PJOVT 🗾w-FUTHSPXUPHFUIFS w:PVDBOXPSL SFNPUFMZGSPNBMM PWFS+BQBO w4FFBHJMFFTNDPKQ

  8. None
  9. None
  10. w +BWB4DSJQU1SFUUJFS &4-JOU w (P(PGNU w 3VTU3VTUGNU $MJQQZ w 3VCZ3VCP$PQ

    4UBOEBSE BOE PUIFST -JOUFS'PSNBUUFS
  11. IUUQTSBJMTIPTUJOHDPNXIJDISVCZHFNTEPZPVMPWF

  12. IUUQTSBJMTIPTUJOHDPNXIJDISVCZHFNTGSVTUSBUFZPVUIFNPTU

  13. 3VCP$PQDPSFEFWFMPQFST +0900 UTC+0200 +0300 +0800 -0400 .PSFUIBODPOUSJCVUPST

  14. 3VCP$PQDPSFEFWFMPQFST +0900 UTC+0200 +0300 +0800 -0400 .PSFUIBODPOUSJCVUPST "VUIPS

  15. 5IFpSTUDPNNJU % git log -p --reverse commit afbead34db54506c12a21dbd4ce04fada0f8b9a4 Author: Bozhidar

    Batsov <bozhidar@batsov.com> Date: Sat Apr 21 13:06:42 2012 +0300 Initial commit to rubocop. --- .document | 5 +++++ .gitignore | 49 +++++++++++++++++++++++++++++++++++++++ ++++++++++ .rspec | 1 + Gemfile | 16 ++++++++++++++++ LICENSE.txt | 20 ++++++++++++++++++++ README.rdoc | 19 +++++++++++++++++++ Rakefile | 45 +++++++++++++++++++++++++++++++++++++++ ++++++ features/rubocop.feature | 9 +++++++++ features/step_definitions/rubocop_steps.rb | 0 features/support/env.rb | 13 +++++++++++++
  16. 5IFpSTUDPNNJU % git log -p --reverse commit afbead34db54506c12a21dbd4ce04fada0f8b9a4 Author: Bozhidar

    Batsov <bozhidar@batsov.com> Date: Sat Apr 21 13:06:42 2012 +0300 Initial commit to rubocop. --- .document | 5 +++++ .gitignore | 49 +++++++++++++++++++++++++++++++++++++++ ++++++++++ .rspec | 1 + Gemfile | 16 ++++++++++++++++ LICENSE.txt | 20 ++++++++++++++++++++ README.rdoc | 19 +++++++++++++++++++ Rakefile | 45 +++++++++++++++++++++++++++++++++++++++ ++++++ features/rubocop.feature | 9 +++++++++ features/step_definitions/rubocop_steps.rb | 0 features/support/env.rb | 13 +++++++++++++ 👈
  17. UI"OOJWFSTBSZZFBS🎉

  18. 3VCP$PQDPSFEFWFMPQFST +0900 UTC+0200 +0300 +0800 -0400 .PSFUIBODPOUSJCVUPSTJOZFBST .F

  19. .F

  20. .BJOUBJO3VCP$PQ)2&WFSZ%BZ IUUQTHJUIVCDPNLPJD PSHSVCPDPQ

  21. None
  22. 5IJTUBMLFYQMBJOT POFPGUIFNJMFTUPOFTPG3VCP$PQ

  23. w5BHMJOFPG3VCP$PQMJLF 3VCZY w*OPUIFSXPSET 3VCP$PQ BJNTUPCFUXJDFBTGBTUBT 3VCP$PQ 3VCP$PQY

  24. (SPXJOHOFFEGPS EFWFMPQFSFYQFSJFODF

  25. w"QBSUPGMPDBMCVJMEQSPDFTT w$POUJOVPVT*OUFHSBUJPO w*OUFHSBUJPOBOEJOUFSBDUJPO XJUIFEJUPST*%&T QSPNJOFOUSFDFOUMZ 6TFDBTFTPG3VCP$PQ

  26. /PPOFDPNQMBJOTBCPVU CFUUFSQFSGPSNBODF💨

  27.  $BDIJOH  .VMUJDPSFT  3FEVDFVOVTFESFRVJSFT  %BFNPOJ[F )PXUPNBLFJUGBTUFS

  28. w*UIBWFCFFOQSPWJEFEGPSBMPOHUJNF w4UPSFEJOUP~/.cache/rubocop_cache CZEFGBVMU w4QFDJGZcache=falseJGZPVXBOUUP EJTBCMFUIFDBDIF $BDIJOH

  29. w3VCP$PQ SVOTQBSBMMFM JOTQFDUJPOCZEFGBVMU   w3VCP$PQ DBOSVO QBSBMMFMBVUPDPSSFDUJPO  .VMUJDPSFT

    /&8
  30. DPSF$16T )ZQFS5ISFBEJOH TFD      OPQBSBMMFM QBSBMMFM

    w8IFO3VCP$PQ JOTQFDUTBMPUPG pMFT JUXJMMCF FGGFDUJWF wFHTFDTFD BCPVUpMFT
  31. w"MMDPQTBSFMPBEFEFWFOXJUI UIF--onlyPQUJPO w/PUJNQMFNFOUFEZFUEVFUP MBSHFJOUFSOBMDIBOHFT 5#%  w1BSUJBMMZSFMBUFEUPTFSWFSNPEF 3FEVDFVOVTFESFRVJSFT

  32. w8F3VCP$PQEFWFMPQFSTXFSF BXBSFPGUIFDPTUPGJOJUJBM NPEVMFMPBEJOH w*JOUFHSBUFESVCPDPQEBFNPO JOUP3VCP$PQDPSF %BFNPOJ[F TFSWFSNPEF

  33. YGBTUFSNPEVMFMPBEJOH TFD      SFRVJSFSVCPDPQ SFRVJSFSVCPDPQTFSWFS wrequire

    'rubocop' SFRVJSFTNPTUPGpMFT wrequire 'rubocop/ server'POMZSFRVJSFT pMFTOFFEFEGPS TFSWFSNPEF
  34. %JWFJOUPUIFTFSWFSNPEF UPEBZ

  35.  1BTUBOEDVSSFOU  8IBUTSVCPDPQEBFNPO  *OUFHSBUFXJUISVCPDPQEBFNPO  5IFTFSWFSNPEF"1*EFTJHO  4FSWFSQSPDFTTBOEDBDIJOHpMFT

    "HFOEB
  36.  1BTUBOEDVSSFOU  8IBUTSVCPDPQEBFNPO  *OUFHSBUFXJUISVCPDPQEBFNPO  5IFTFSWFSNPEF"1*EFTJHO  4FSWFSQSPDFTTBOEDBDIJOHpMFT

    "HFOEB
  37. #FGPSFSVCPDPQEBFNPO JOUFHSBUJPO 1BTUBOEDVSSFOU

  38. *OTJEFUSBEJUJPOBMrubocopDPNNBOE 3VCP$PQQSPDFTT 1*% # exe/rubocop (snip) require 'rubocop' RuboCop::CLI.new.run •RuboCop::CLI.new.runJTBOFOEQPJOU"1*

    w&BDICPPUrubocopQSPDFTTSVOTSVCPDPQDPNNBOE # Term #1 % rubocop 4UBSUBOESVO
  39. 3VCP$PQQSPDFTT 1*% *OTJEFUSBEJUJPOBMrubocopDPNNBOE # exe/rubocop (snip) require 'rubocop' RuboCop::CLI.new.run •RuboCop::CLI.new.runJTBOFOEQPJOU"1*

    w&BDICPPUrubocopQSPDFTTSVOTSVCPDPQDPNNBOE # Term #1 % rubocop # Term #2 % rubocop 4UBSUBOESVO 3VCP$PQQSPDFTT 1*% # exe/rubocop (snip) require 'rubocop' RuboCop::CLI.new.run 4UBSUBOESVO
  40. 3VCP$PQQSPDFTT 1*% *OTJEFUSBEJUJPOBMrubocopDPNNBOE # exe/rubocop (snip) require 'rubocop' RuboCop::CLI.new.run •RuboCop::CLI.new.runJTBOFOEQPJOU"1*

    w&BDICPPUrubocopQSPDFTTSVOTSVCPDPQDPNNBOE # Term #1 % rubocop # Term #2 % rubocop # Term #3 % rubocop 4UBSUBOESVO 4UBSUBOESVO 3VCP$PQQSPDFTT 1*% # exe/rubocop (snip) require 'rubocop' RuboCop::CLI.new.run 3VCP$PQQSPDFTT 1*% # exe/rubocop (snip) require 'rubocop' RuboCop::CLI.new.run 4UBSUBOESVO
  41. 3VCP$PQQSPDFTT 1*% *OTJEFUSBEJUJPOBMrubocopDPNNBOE # exe/rubocop (snip) require 'rubocop' RuboCop::CLI.new.run •RuboCop::CLI.new.runJTBOFOEQPJOU"1*

    w&BDICPPUrubocopQSPDFTTSVOTSVCPDPQDPNNBOE # Term #1 % rubocop # Term #2 % rubocop # Term #3 % rubocop 4UBSUBOESVO 4UBSUBOESVO 3VCP$PQQSPDFTT 1*% # exe/rubocop (snip) require 'rubocop' RuboCop::CLI.new.run 3VCP$PQQSPDFTT 1*% # exe/rubocop (snip) require 'rubocop' RuboCop::CLI.new.run 1*%TBSFBMXBZTEJ⒎FSFOU 4UBSUBOESVO
  42. w/FFETrequire 'rubocop'UPVTFUIF"1* w*ODMVEFTFWFSZUIJOHZPVOFFEGPS 3VCP$PQ w.PTUPGpMFTJTSFRVJSFEBOE JUJTTMPX RuboCop::CLI.new.run"1*

  43. SVCPDPQEBFNPOHFN "SFTPMVUJPOCZUIJSEQBSUZ

  44. None
  45.  1BTUBOEDVSSFOU  8IBUTSVCPDPQEBFNPO  *OUFHSBUFXJUISVCPDPQEBFNPO  5IFTFSWFSNPEF"1*EFTJHO  4FSWFSQSPDFTTBOEDBDIJOHpMFT

    "HFOEB
  46. w"!GPIUFQSPEVDU w&OEPSTFECZTPNFPG*%& JOUFHSBUJPOVTFST w5IBUTXIBUVTFSTSFBMMZXBOU "VTFDBTFESJWFO 8IBUTSVCPDPQEBFNPO

  47. )PXEJESVCPDPQEBFNPO NBLF3VCP$PQGBTU

  48. w$MJFOU4FSWFSNPEFM w4FSWFS.PEVMFTBSFMPBEFE POMZPODFEVSJOHCPPUQSPDFTT w$MJFOU$POOFDUTUPUIFTFSWFS UIBUBMSFBEZMPBEFENPEVMFT 4FQBSBUFNPEVMFMPBEJOHGSPNCPPUTUSBQ

  49. $MJFOU1SPDFTT 1*% 4UBSU%BFNPO 4FSWFS 4FSWFS1SPDFTT 1*% # Loading dependencies. require

    'rubocop' TCPServer.open('127.0.0.1', port) Process.daemon(true) rubocop-daemon % rubocop-daemon start rubocop rubocop-daemon startTUBSUTTFSWFSQSPDFTT
  50. $MJFOU1SPDFTT 1*% 4UBSU%BFNPO 4FSWFS 4FSWFS1SPDFTT 1*% # Loading dependencies. require

    'rubocop' TCPServer.open('127.0.0.1', port) Process.daemon(true) rubocop-daemon % rubocop-daemon start rubocop rubocop-daemon startTUBSUTUIFQSPDFTTBTEBFNPO Process.daemon(true)
  51. 6QBOESVOOJOH $MJFOU1SPDFTT 1*% 4UBSU%BFNPO 4FSWFS 4FSWFS1SPDFTT 1*% # Loading dependencies.

    require 'rubocop' TCPServer.open('127.0.0.1', port) Process.daemon(true) rubocop-daemon % rubocop-daemon start rubocop rubocop-daemon startTUBSUTUIFQSPDFTTBTEBFNPO Process.daemon(true)
  52. 6QBOESVOOJOH $MJFOU1SPDFTT 1*% &YFD3VCP$PQ 7JBDMJFOU 4FSWFS1SPDFTT 1*% # Loaded API

    RuboCop::CLI.new.run rubocop-daemon % rubocop-daemon exec rubocop rubocop-daemon execSVOTCLI.new.run PGEBFNPO TCP/IP TCPSocket.open('127.0.0.1', port)
  53. 6QBOESVOOJOH $MJFOU1SPDFTT 1*% &YFD3VCP$PQ 7JBDMJFOU 4FSWFS1SPDFTT 1*% # Loaded API

    RuboCop::CLI.new.run rubocop-daemon % rubocop-daemon exec $MJFOU1SPDFTT 1*% % rubocop-daemon exec rubocop $POUJOVFUPDPOOFDUUPUIFBMSFBEZSVOOJOHEBFNPO TCP/IP TCP/IP
  54. 6QBOESVOOJOH $MJFOU1SPDFTT 1*% &YFD3VCP$PQ 7JBDMJFOU 4FSWFS1SPDFTT 1*% # Loaded API

    RuboCop::CLI.new.run rubocop-daemon % rubocop-daemon exec $MJFOU1SPDFTT 1*% % rubocop-daemon exec rubocop $POUJOVFUPDPOOFDUUPUIFBMSFBEZSVOOJOHEBFNPO "MXBZTUIFTBNF1*% TCP/IP TCP/IP
  55. *ODPOWFOJFOUUXPQIBTF

  56. SVCPDPQEBFNPOXSBQQFS 4FSWFS1SPDFTT QJE require 'rubocop' TCPServer.open('127.0.0.1', port) Process.daemon(true) rubocop-daemon-wrapper rubocop

    5IFTIFMMTDSJQUTUBSUTUIFEBFNPOJGJUJTOPUSVOOJOH $MJFOU1SPDFTT QJE if [ ! -f "$TOKEN_PATH" ]; then $RUBOCOP_DAEMON start fi # snip if ! run_rubocop_command $@; then RuboCop::CLI.new.run # ~/.bashrc export PATH="/usr/local/bin/rubocop-daemon-wrapper:$PATH" ncDNE  
  57. 4FSWFS1SPDFTT QJE require 'rubocop' TCPServer.open('127.0.0.1', port) Process.daemon(true) SVCPDPQEBFNPOXSBQQFS rubocop-daemon-wrapper rubocop

    5IFTIFMMTDSJQUTUBSUTUIFEBFNPOJGJUJTOPUSVOOJOH $MJFOU1SPDFTT QJE if [ ! -f "$TOKEN_PATH" ]; then $RUBOCOP_DAEMON start fi # snip if ! run_rubocop_command $@; then RuboCop::CLI.new.run # ~/.bashrc export PATH="/usr/local/bin/rubocop-daemon-wrapper:$PATH" ncDNE   $RUBOCOP_DAEMON start require 'rubocop' TCPServer.open('127.0.0.1', port) Process.daemon(true)
  58. SVCPDPQEBFNPOXSBQQFS 4FSWFS1SPDFTT QJE require 'rubocop' TCPServer.open('127.0.0.1', port) Process.daemon(true) rubocop-daemon-wrapper rubocop

    5IFTIFMMTDSJQUTUBSUTUIFEBFNPOJGJUJTOPUSVOOJOH $MJFOU1SPDFTT QJE if [ ! -f "$TOKEN_PATH" ]; then $RUBOCOP_DAEMON start fi # snip if ! run_rubocop_command $@; then RuboCop::CLI.new.run # ~/.bashrc export PATH="/usr/local/bin/rubocop-daemon-wrapper:$PATH" ncDNE   run_rubocop_command RuboCop::CLI.new.run
  59. SVCPDPQEBFNPOXSBQQFS 4FSWFS1SPDFTT QJE require 'rubocop' TCPServer.open('127.0.0.1', port) Process.daemon(true) rubocop-daemon-wrapper rubocop

    5IFTIFMMTDSJQUTUBSUTUIFEBFNPOJGJUJTOPUSVOOJOH $MJFOU1SPDFTT QJE if [ ! -f "$TOKEN_PATH" ]; then $RUBOCOP_DAEMON start fi # snip if ! run_rubocop_command $@; then RuboCop::CLI.new.run # ~/.bashrc export PATH="/usr/local/bin/rubocop-daemon-wrapper:$PATH" ncDNE   # ~/.bashrc export PATH="/usr/local/bin/rubocop-daemon-wrapper:$PATH"
  60. *OUFHSBUJPOSVCPDPQEBFNPOJOUP 3VCP$PQJTBVTFGVMBQQSPBDI

  61.  1BTUBOEDVSSFOU  8IBUTSVCPDPQEBFNPO  *OUFHSBUFXJUISVCPDPQEBFNPO  5IFTFSWFSNPEF"1*EFTJHO  4FSWFSQSPDFTTBOEDBDIJOHpMFT

    "HFOEB
  62. SVCPDPQSVCPDPQ 1FSGPSNBODFJNQSPWFNFOUTGPSCFUUFSFEJUPSJOUFHSBUJPO

  63. None
  64. 5IJTJTBTUPSZPGIPX* EJE3VCZ,BJHJESJWFO EFWFMPQNFOU "OE*SFHSFUUIBU*EJEOPU SFBDIUIFNJMFTUPOFQVMM SFRVFTUOVNCFS ΩϦ൪ 😅 3*4&61

  65. SVCPDPQSVCPDPQ *OUFHSBUFSVCPDPQEBFNPO

  66. None
  67. )PXUPJOUFHSBUFXJUI SVCPDPQEBFNPO

  68. $MJFOU1SPDFTT 1*% "CPVUUIFTFSWFSNPEF client process % rubocop --server server process

    4QFDJGZ--serverPQUJPOUPCPPUJOTFSWFSNPEF
  69. $MJFOU1SPDFTT 1*% "CPVUUIFTFSWFSNPEF 4FSWFS1SPDFTT 1*% require 'rubocop/server' server_cli = RuboCop::Server::CLI.new

    exit_status = server_cli.run exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end client process % rubocop --server server process 4UBSUTFSWFSQSPDFTTFTBOEJOTQFDUTPVSDFDPEF
  70. $MJFOU1SPDFTT 1*% "CPVUUIFTFSWFSNPEF 4FSWFS1SPDFTT 1*% require 'rubocop/server' server_cli = RuboCop::Server::CLI.new

    exit_status = server_cli.run exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end client process % rubocop --server $MJFOU1SPDFTT 1*% % rubocop --server server process $POUJOVFUPDPOOFDUUPBOBMSFBEZSVOOJOHTFSWFS "MXBZTUIFTBNFQSPDFTT
  71. 0VUMJOFPGTFSWFSNPEF

  72. wRuboCop::CLI.new.runJTGPS OPTFSWFSNPEF EFGBVMU  wRuboCop::Server::CLI.new. runJTGPSTFSWFSNPEF 5XPFOEQPJOU"1*T

  73. wrequire 'rubocop'SFRVJSFT NPTUPGpMFT IFBWZXFJHIU  wrequire 'rubocop/server'POMZ SFRVJSFTpMFTOFFEFEGPS TFSWFSNPEF MJHIUXFJHIU

    3FEVDFSFRVJSFENPEVMFT
  74. YGBTUFSNPEVMFMPBEJOH TFD      SFRVJSFSVCPDPQ SFRVJSFSVCPDPQTFSWFS wrequire

    'rubocop' SFRVJSFTNPTUPGpMFT wrequire 'rubocop/ server'POMZSFRVJSFT pMFTOFFEFEGPS TFSWFSNPEF
  75. YGBTUFS % ruby -rbenchmark -e '$LOAD_PATH.unshift("/path/to/rubocop/lib"); Benchmark.bm { |x| x.report

    { require "rubocop" }}' user system total real 0.573636 0.217166 0.790802 ( 0.815585) % ruby -rbenchmark -e '$LOAD_PATH.unshift("/path/to/rubocop/lib"); Benchmark.bm { |x| x.report { require "rubocop/server" }}' user system total real 0.000386 0.000587 0.000973 ( 0.000969) SFRVJSFSVCPDPQ SFRVJSFSVCPDPQTFSWFS
  76. 1BTUexe/rubocop  $LOAD_PATH.unshift("#{__dir__}/../lib") require 'rubocop' RuboCop::CLI.new.run $PEFTOJQQFU &YFDVUFEFBDIUJNFXJUIUIFASVCPDPQADPNNBOE 3FRVJSFEFBDIUJNFXJUIUIFASVCPDPQADPNNBOE

  77. $VSSFOUexe/rubocop "GUFS require 'rubocop/server' server_cli = RuboCop::Server::CLI.new exit_status = server_cli.run

    exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end $PEFTOJQQFU .BLFBMJHIUXFJHIUEFQFOEFODZSFRVJSF require 'rubocop/server'
  78. $VSSFOUexe/rubocop "GUFS require 'rubocop/server' server_cli = RuboCop::Server::CLI.new exit_status = server_cli.run

    exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end $PEFTOJQQFU .BLFBMJHIUXFJHIUEFQFOEFODZSFRVJSF 4FSWFSNPEFTFUVQ FHTUBSUJOHBOETUPQQJOH server_cli = RuboCop::Server::CLI.new exit_status = server_cli.run exit exit_status if server_cli.exit?
  79. $VSSFOUexe/rubocop "GUFS require 'rubocop/server' server_cli = RuboCop::Server::CLI.new exit_status = server_cli.run

    exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end $PEFTOJQQFU .BLFBMJHIUXFJHIUEFQFOEFODZSFRVJSF 4FSWFSNPEFTFUVQ FHTUBSUJOHBOETUPQQJOH $IFDLTFSWFSTUBUVT if RuboCop::Server.running?
  80. $VSSFOUexe/rubocop "GUFS require 'rubocop/server' server_cli = RuboCop::Server::CLI.new exit_status = server_cli.run

    exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end $PEFTOJQQFU .BLFBMJHIUXFJHIUEFQFOEFODZSFRVJSF 4FSWFSNPEFTFUVQ FHTUBSUJOHBOETUPQQJOH $IFDLTFSWFSTUBUVT 3VOOJOHXJUITFSWFSNPEF exit_status = RuboCop::Server::ClientCommand::Exec.new.run
  81. $VSSFOUexe/rubocop "GUFS require 'rubocop/server' server_cli = RuboCop::Server::CLI.new exit_status = server_cli.run

    exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end $PEFTOJQQFU .BLFBMJHIUXFJHIUEFQFOEFODZSFRVJSF 4FSWFSNPEFTFUVQ FHTUBSUJOHBOETUPQQJOH $IFDLTFSWFSTUBUVT 3VOOJOHXJUIOPTFSWFSNPEF 3VOOJOHXJUITFSWFSNPEF require 'rubocop' cli = RuboCop::CLI.new.run
  82. $VSSFOUexe/rubocop "GUFS require 'rubocop/server' server_cli = RuboCop::Server::CLI.new exit_status = server_cli.run

    exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end $PEFTOJQQFU .BLFBMJHIUXFJHIUEFQFOEFODZSFRVJSF 4FSWFSNPEFTFUVQ FHTUBSUJOHBOETUPQQJOH $IFDLTFSWFSTUBUVT 3VOOJOHXJUIOPTFSWFSNPEF 3VOOJOHXJUITFSWFSNPEF require 'rubocop' cli = RuboCop::CLI.new.run 4MPX
  83. .VDIMJHIUFSUIBOrequire 'rubocop' require 'rubocop/server' server_cli = RuboCop::Server::CLI.new exit_status = server_cli.run

    exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end $PEFTOJQQFU .BLFBMJHIUXFJHIUEFQFOEFODZSFRVJSF 4FSWFSNPEFTFUVQ FHTUBSUJOHBOETUPQQJOH $IFDLTFSWFSTUBUVT 3VOOJOHXJUITFSWFSNPEF server_cli = RuboCop::Server::CLI.new exit_status = server_cli.run exit exit_status if server_cli.exit? exit_status = RuboCop::Server::ClientCommand::Exec.new.run require 'rubocop/server' if RuboCop::Server.running?
  84. $MJFOU1SPDFTT 1*% &YFD3VCP$PQXJUITFSWFS 4FSWFS1SPDFTT 1*% require 'rubocop/server' server_cli = RuboCop::Server::CLI.new

    exit_status = server_cli.run exit exit_status if server_cli.exit? if RuboCop::Server.running? exit_status = RuboCop::Server::ClientCommand::Exec.new.run else require 'rubocop' cli = RuboCop::CLI.new.run end rubocop client % rubocop --server $MJFOU1SPDFTT 1*% % rubocop --server rubocop server $POUJOVFUPDPOOFDUUPBOBMSFBEZSVOOJOHTFSWFS "MXBZTUIFTBNFQSPDFTT
  85. w0CKFDUTMPBEFEXJUIrequire  require_relativeFUD JUJTJO NFNPSZ w5IFTFSWFSQSPDFTTJTGBTUFSXIFO SFRVJSFENPEVMFTBSFMPBEFE 4QFFEVQXJUITFSWFS

  86. 1SPHSBNNJOHXIBUJTDPEFEBOE XIBUJTOPUDPEFE !LBLVUBOJTBZT IUUQTTQFBLFSEFDLDPNLBLVUBOJBHJMFNBOJGFTUPEFDBEF TMJEF

  87.  1BTUBOEDVSSFOU  8IBUTSVCPDPQEBFNPO  *OUFHSBUFXJUISVCPDPQEBFNPO  5IFTFSWFSNPEF"1*EFTJHO  4FSWFSQSPDFTTBOEDBDIJOHpMFT

    "HFOEB
  88. $PNNBOEMJOF"1*EFTJHO

  89. $PNNBOEMJOF"1*EFTJHO IUUQTHJUIVCDPNSVCPDPQSVCPDPQQVMMJTTVFDPNNFOU rubocop --serverWTrubocop-server

  90. w"OPUIFSPQUJPOJTrubocop-server DPNNBOEGPSTFSWFSNPEF w*UJTFBTZUPEFTJHOUIFTFSWFSQPSU OVNCFSBTBDPNNBOEMJOFBSHVNFOU w-JLFemacsclientDPNNBOE 8IZOPUrubocop-server

  91. wSVCPDPQEBFNPOVTFSTTFFNUPXBOUUPTUBSUUIF TFSWFSXJUIrubocopDPNNBOE JGUIFTFSWFSJTOPU TUBSUFE  w5IBUTXIZrubocop-daemon-wrapperJTQSPWJEFE w"GUFSBMM*BMJBTUPFNBDT •alias emacs='emacsclient -nw

    -a ""' w*DIPTFUPBEE--serverPQUJPOUPUIFrubocopDPNNBOE 8IZOPUrubocop-server
  92. *NQPSUFESVCPDPQEBFNPOPQUJPOT SVCPDPQEBFNPO SVCPDPQ OPUF FYFD rubocop-daemon exec rubocop --server rubocopJTBMTP0,BGUFS

    TUBSUJOHUIFTFSWFS FYFDXP TFSWFS N/A rubocop --no-server %FGBVMUXJUIPVUTFSWFS PQUJPOT TUBSUTFSWFS rubocop-daemon start rubocop --start-server )PTUBOEQPSUDBOCF TQFDJpFEXJUIFOWWBST TUPQTFSWFS rubocop-daemon stop rubocop --stop-server SFTUBSU rubocop-daemon restart rubocop --restart-server TUBUVT rubocop-daemon status rubocop --server-status TUBSUFYFD rubocop-daemon-wrapper rubocop --server
  93. 4FSWFSNPEFPQUJPOT

  94. w5IFEFGBVMUCFIBWJPS w3VOXJUIPVUTFSWFS w*UTDPNQBUJCMFXJUIPME3VCP$PQ WFSTJPOT w*UTTUBCMFCVUTMPX --no-server EFGBVMU

  95. w3VOJOTQFDUJPOBGUFSTUBSUJOHSVCPDPQ TFSWFSQSPDFTTJGOPUTUBSUFE w"GUFSFYFDVUJOH--serverPQUJPO  rubocopDPNNBOESVOTBTDMJFOU w*EMJLFUPDSFBUFBTIPSUOBNFCVU-sJT BMSFBEZVTFE --server

  96. w4FSWFSQSPDFTTOBNFJT rubocop --server #{dirname} w3VCP$PQTFSWFSTBSFBTTPDJBUFEXJUI UIFEJSFDUPSZJOXIJDIUIFZXFSFTUBSUFE 4FSWFSQSPDFTTOBNF % ps aux

    | grep 'rubocop --server' user 16060 0.0 0.0 5078568 2264 ?? S 7:54AM 0:00.00 rubocop --server /Users/koic/src/github.com/esminc/foo user 16337 0.0 0.0 5331560 2396 ?? S 23:51PM 0:00.00 rubocop --server /Users/koic/src/github.com/esminc/bar
  97. w4UZMFTXJMMWBSZGSPNQSPKFDUUPQSPKFDU w$POpHVSFTSVMFTCZSVCPDPQZNM w&BDITFSWFSIBTJUTPXOQSPKFDU TFUUJOHT w4FSWFSTUBSUTGPSFBDIQSPKFDU TP JOEFQFOEFOUQSPKFDUQSFGFSFODFTBQQMZ $POpHVSBUJPOTBSFOFWFSNJYFE

  98. w4UBSU3VCP$PQTFSWFSQSPDFTT w6TFXIFOZPVXBOUUPTUBSUUIFTFSWFSPOMZ w5$1IPTUBOEQPSUDBOCFTQFDJpFEXJUIFOWJSPONFOU WBSJBCMFT w$RUBOCOP_SERVER_HOST w$RUBOCOP_SERVER_PORT wFH3VCP$PQ4FSWFSSVOTBT%PDLFSDPOUBJOFSBOE VTFSVTFTMJLFrubocop-daemon-wrapperPOIPTUNBDIJOF --start-server

  99. w4UPQ3VCP$PQTFSWFSQSPDFTT w6TFUIJTPQUJPOXIFOTFSWFS NPEFJTVOTUBCMF wFH6QEBUFHFN  DPOpHVSBUJPO BOEFUD --stop-server

  100. w3FTUBSUTFSWFSQSPDFTT w4IPSUIBOEGPSTUPQBOETUBSU w:PVNBZVTFJUBGUFSbundle updateXIFO3VCP$PQTFSWFSJT VOTUBCMF --restart-server

  101. w:PVDBODPOpSNTFSWFS TUBUVT w4IPXOXJUI1*%XIFOSVOOJOH --server-status % rubocop --server-status RuboCop server (25960)

    is running. % rubocop --server-status RuboCop server is not running.
  102. w:PVDBOBMTPDPOpSNrubocop -V w+serverJTBEEFE w-VPQUJPOQSPWJEFTJOGPVTFEJOJTTVFSFQPSUT w-JLFruby -vGPSFOBCMF:+*5 +YJITJTBEEFE rubocop -V -BSHF7

    % ruby --yjit -ve 'RubyVM::YJIT.enabled?' ruby 3.2.0dev (2022-09-08T05:31:42Z master 78af05ba0f) +YJIT [x86_64-darwin19] % rubocop -V 1.36.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.2.0) +server [x86_64-darwin19]
  103. " 3VOrubocopXJUIPVUTFSWFS QSPDFTTJGUIFQSPDFTTJTOPU SVOOJOH # 3VOrubocopXJUITFSWFSQSPDFTT JGUIFQSPDFTTJTSVOOJOH /PTFSWFSPQUJPOTHJWFO

  104. w*GZPVFODPVOUFSFE VOFYQFDUFECFIBWJPST 3VO rubocop--restart-server w"OEZPVDBOPQFOBOJTTVFUP UIFSVCPDPQSVCPDPQSFQP "UUFOUJPOT

  105.  1BTUBOEDVSSFOU  8IBUTSVCPDPQEBFNPO  *OUFHSBUFXJUISVCPDPQEBFNPO  5IFTFSWFSNPEF"1*EFTJHO  4FSWFSQSPDFTTBOEDBDIJOHpMFT

    "HFOEB
  106. 4FSWFSQSPDFTTBOE DBDIJOHpMFT

  107. w3VCP$PQTFSWFSNPEF VTFT5$1*1QSPUPDPM w*ULFFQTUIFTFSWFST1*% FUDJOUIFDBDIFEJSFDUPSZ "CPVUUIFTFSWFSNPEFQSPUPDPM

  108. $MJFOU1SPDFTT 1*% TU4UBSUBOEFYFDUIFTFSWFS 4FSWFS1SPDFTT 1*% client % rubocop --server server

    4UBSUBOFXTFSWFSQSPDFTTBOEHFUUIF1*% Socket
  109. DBDIFSVCPDPQ@DBDIFTFSWFS $MJFOU1SPDFTT 1*% TU4UBSUBOEFYFDUIFTFSWFS 4FSWFS1SPDFTT 1*% % rubocop --server 8SJUFQJE

    QPSU WFSTJPO BOEPUIFSTUPDBDIFpMFT QJE QPSU WFSTJPO Disk IO client server
  110. DBDIFSVCPDPQ@DBDIFTFSWFS $MJFOU1SPDFTT 1*% OE&YFDUIFTFSWFS 4FSWFS1SPDFTT 1*% % rubocop --server 3FBEQJE

    QPSU WFSTJPO BOEPUIFSTUPDBDIFpMFT QJE QPSU WFSTJPO $MJFOU1SPDFTT 1*% % rubocop (--server) Disk IO client server
  111. DBDIFSVCPDPQ@DBDIFTFSWFS $MJFOU1SPDFTT 1*% OE&YFDUIFTFSWFS 4FSWFS1SPDFTT 1*% % rubocop --server $POOFDUUPUIFTFSWFSQSPDFTTBOEJOTQFDUJPO

    QJE QPSU WFSTJPO $MJFOU1SPDFTT 1*% % rubocop (--server) Socket client server
  112. DBDIFSVCPDPQ@DBDIFTFSWFS $MJFOU1SPDFTT 1*% 5IFDBDIFEJSFDUPSZ 4FSWFS1SPDFTT 1*% % rubocop --server 5IFDBDIFJTQMBDFEJO~/.cacheEJSFDUPSZCZEFGBVMU

    QJE QPSU WFSTJPO $MJFOU1SPDFTT 1*% % rubocop (--server) client server
  113. DBDIFSVCPDPQ@DBDIFTFSWFS $MJFOU1SPDFTT 1*% 5IFDBDIFEJSFDUPSZ 4FSWFS1SPDFTT 1*% % rubocop --server 3FTUBSUUIFQSPDFTTXIFOBGUFSbundle

    update QJE QPSU WFSTJPO $MJFOU1SPDFTT 1*% % rubocop (--server) 5IFDMJFOUDPNNBOESFTUBSUTUIFTFSWFS QSPDFTTJGJUEFUFDUTJODPNQBUJCMFWFSTJPO client server
  114. w6OGPSUVOBUFMZJUTTUJMMBCJU FYQFSJNFOUBM wrubocop --restart-serverXJMM TUJMMCFOFDFTTBSZJOTPNF TJUVBUJPOT $BOTFSWFSNPEFCFUIFEFGBVMU

  115. w.BLFBVUPSFMPBEBXBSFPG VQHSBEJOHSEQBSUZHFNT w6/*9EPNBJOTPDLFUPQUJPOJGGBTUFS w1SPWJEFTPQUJPOTGPSTIPSUBMJBTFT w4VQQPSU+3VCZ  4FSWFSNPEFFOIBODFEQMBOT

  116. wrubocop --serverDBONBLF 3VCP$PQGBTUFS wrubocop --restart-serverNBZ TPMWFZPVSTFSWFSNPEFJTTVF 6TFGVMPQUJPOT

  117. -FBSOGSPNZFTUFSEBZ rubocop.org MJWFGPSUPEBZ IPQFGPSUPNPSSPX ʔAlbert Einstein