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

OSSにみるレールの外側

 OSSにみるレールの外側

Railsを使う大きなメリットの1つは、「ここはこう書く」Rails wayがあることで、(自分を含む)他人が書いたコードでも読みやすい点にあると思っています。このことは、完全リモートワークの弊社でRailsを使う理由のひとつでもあります。
では、同じように地理的に離れた場所にいる多くの開発者が参加するOSS開発の現場において、Rails wayから離れたコードをどのように扱っているのでしょうか?それを知ることはリモートワークでRails開発をする上でのヒントになるかも知れないと考え、今回 GitLab / Discourse / Mastodon という3つのRailsプロジェクトについてコードリーディングを行いました。

Yuichi Takeuchi

July 25, 2018

Transcript

54 slides
  1. RuboCop::Cop::GitLab::Find erWithFindBy rubocop/cop/gitlab/ finder_with_find_by.rb # 通常こうやって #execute を使うんだけど results =

    DummyFinder.new(some_args).execute # find_by と組み合わせて使うときは DummyFinder.new(some_args).execute.find_by!(1) # こう書くようにしようね DummyFinder.new(some_args).find_by!(1)
  2. 整理された routes (2) config/routes/api.rb GraphQL と REST API constraints(::Constraints::FeatureConstrainer.new(:graphql)) do

    post '/api/graphql', to: 'graphql#execute' mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: '/api/graphql' end API::API.logger Rails.logger mount API::API => '/'
  3. Discourse の app/jobs 追加 ディレクトリ名かぶりは ActiveJob が後からだからでは ActiveJob に機能が足りないから仕 方ない

    わかる 別にそれ自体はよい、ActiveJobで済むな らそれでいいが、だめなら他の方法は否 定しない
  4. Discourse の Dangerfile (抜 粋) if git.lines_of_code > 500 warn("This

    PR seems big, we prefer smaller PR. Please be sure this is needed and can't be split in smaller PRs.") end

More Decks by Yuichi Takeuchi

Other Decks in Technology