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

技術力向上のためのコードレビューのススメ/#hiraba-tech-night-201805

 技術力向上のためのコードレビューのススメ/#hiraba-tech-night-201805

Masatoshi Moritsuka

May 25, 2018
Tweet

More Decks by Masatoshi Moritsuka

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ ➤ ৿௩ ਅ೥ ➤ RailsϓϩάϥϚʢ༧ఆʣ ➤ ࠷ۙͷؔ৺ࣄ ➤ ϑϩϯτΤϯυ

    ➤ React ➤ Vue ➤ ϞόΠϧΞϓϦ ➤ React Native ➤ Twitterɿ@sanfrecce_osaka
  2. ϓϩάϥϛϯάͷษڧ๏ ➤ ࢓ࣄ ➤ ֶशαʔϏε ➤ εΫʔϧܥ ➤ WebαʔϏεܥ ➤

    νϡʔτϦΞϧ ➤ ٕज़ॻɾυΩϡϝϯτ ➤ ษڧձɾίϛϡχςΟ΁ͷࢀՃ ➤ ίʔυϨϏϡʔΛड͚Δ
  3. ۩ମྫʢίʔυϨϏϡʔલʣ 1 | # frozen_string_literal: true 2 | 3 |

    require 'rake/clean' 4 | 5 | namespace :rubocop do 6 | desc 'ର৅ϑΝΠϧͷจࣈྻΛΠϛϡʔλϒϧʹ͢Δ' 7 | task :add_frozen_string do 8 | LIST_NAME = 'target_list.txt' 9 | CLEAN.include(LIST_NAME) 10 | sh %(bundle exec rubocop | grep "Missing frozen string" | cut -d: -f 1 > #{LIST_NAME}) 11 | File.open(LIST_NAME, 'r+') do |list| 12 | list.each_line do |file_path| 13 | File.open(file_path.chomp, 'r+') do |target| 14 | lines = target.readlines 15 | inserted = "# frozen_string_literal: true\n\n" 16 | if %r{!/usr/bin/env ruby}.match?(lines.first) 17 | lines.insert(1, inserted) 18 | else 19 | lines.unshift(inserted) 20 | end 21 | target.rewind 22 | lines.each { |line| target.write(line) } 23 | end 24 | end 25 | end 26 | Rake::Task['clean'].execute 27 | end 28 | end
  4. ۩ମྫʢίʔυϨϏϡʔޙʣ 1 | # frozen_string_literal: true 2 | 3 |

    namespace :rubocop do 4 | desc 'ର৅ϑΝΠϧͷจࣈྻΛΠϛϡʔλϒϧʹ͢Δ' 5 | task :add_frozen_string do 6 | file_path_list = `bundle exec rubocop | grep "Missing magic comment" | cut -d: -f 1`.chomp.split('\n') 7 | ADDITIONAL_LINE = "# frozen_string_literal: true\n\n" 8 | file_path_list.each do |file_path| 9 | lines = File.readlines(file_path) 10 | if %r{#!/usr/bin/env ruby}.match?(lines.first) 11 | lines.insert(1, ADDITIONAL_LINE) 12 | else 13 | lines.unshift(ADDITIONAL_LINE) 14 | end 15 | File.write(file_path, lines.join('')) 16 | end 17 | end 18 | end
  5. ϨϏϡʔΛड͚Δ৔Λ࡞Δ ➤ ΠϕϯτΛاը͢Δ ➤ ίϛϡχςΟΛ࡞Δ ➤ ϨϏϡʔΠ͚ͩͰͳ͘ϨϏϡΞʔ΋ܦݧͰ͖ΔΑ͏ʹͨ͠ ͍ ➤ αʔϏεΛ࡞Δ

    ➤ @jnchito͞Μͷtrain-ticketͷΑ͏ͳ͓୊ΛूΊͨαʔϏε ➤ ϨϏϡʔड͚͍ͨਓͱϨϏϡʔͯ͘͠ΕΔਓΛ݁ͼ͚ͭΔ ϚονϯάαΠτ