Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Ruby on (Guard)Rails

Ruby on (Guard)Rails

The guardrails I love in the Ruby ecosystem and why you should use and love them too.

Presented at [Haggis Ruby](https://haggisruby.co.uk) in 2024.

Mike McQuaid

October 24, 2024
Tweet

More Decks by Mike McQuaid

Other Decks in Programming

Transcript

  1. 1. 4 rubocop 2. 5 erb_lint 3. 6 better_html 4.

    7 prosopite 5. 8 licensed 6. 0 actionlint 7. 9 eslint 8. % GIVE ME MOAR LINTERS
  2. group :development do gem "better_html" gem "erb_lint" gem "licensed" gem

    "rubocop-capybara" gem "rubocop-performance" gem "rubocop-rails" gem "rubocop-rspec" gem "rubocop-rspec_rails" end
  3. require: - rubocop-performance - rubocop-rails - rubocop-rspec - rubocop-rspec_rails -

    rubocop-sorbet - rubocop-capybara AllCops: TargetRubyVersion: 3.3 ActiveSupportExtensionsEnabled: true NewCops: enable EnabledByDefault: true Layout: Exclude: - "db/migrate/*.rb"
  4. # Bulk create BrewCommandRuns for each Device. # Since there

    are no callbacks or validations on # BrewCommandRun, we can safely use insert_all! # # rubocop:disable Rails/SkipsModelValidations BrewCommandRun.insert_all!(new_brew_command_runs) # rubocop:enable Rails/SkipsModelValidations
  5. 1. : rspec 2. ; simplecov 3. < playwright 4.

    = vcr 5. > parallel_tests 6. ? CodeCov 7. 0 GitHub Actions
  6. $ bin/parallel_rspec Using recorded test runtime 10 processes for 80

    specs, ~ 8 specs per process ............................................................... ............................................................... ............................................................... ............................................................... ............................................................... ............................................................... ............................................................... ......................................................... Coverage report generated to /Users/mike/Workbrew/console/ coverage. Line Coverage: 100.0% (6371 / 6371) Branch Coverage: 89.6% (1240 / 1384) Took 15 seconds
  7. group :test do gem "capybara-playwright-driver" gem "parallel_tests" gem "rspec-github" gem

    "rspec-rails" gem "rspec-sorbet" gem "simplecov" gem "simplecov-cobertura" gem "vcr" end
  8. # typed: strict class TapsController < ApplicationController sig { void

    } def initialize super @tap_packages = T.let(nil, T.nilable(T::Hash[String, T::Array[String]])) @homebrew_core_count = T.let(nil, T.nilable(Integer)) @homebrew_cask_count = T.let(nil, T.nilable(Integer)) @homebrew_cask_font_count = T.let(nil, T.nilable(Integer)) end ... end
  9. gem "sorbet-runtime" group :development do gem "rubocop-sorbet" gem "sorbet" gem

    "tapioca" end group :test do gem "rspec-sorbet" end