- Ruby on Rails 7.1.x
- Ruby 3.3.x
- SQLite3
- SolidQueue
- Hotwire
- Import maps
- Tailwind CSS
- Run
bin/setup(needs to be run only once) - Run
bin/dev
or
- Run
docker compose up
We use Standard Ruby for linting and formatting.
- Run
bundle exec rubocopto check all ruby files - Run
bundle exec rubocop -ato auto-correct offenses - How do I run RuboCop in my editor?
We use ERB Lint to lint our ERB files.
- Run
bundle exec erblint --lint-allto check all ERB files - Run
bundle exec erblint --lint-all -ato auto-correct offenses. WARNING: This command isn't safe and can break your code.
We use StandardJS to lint our JavaScript files.
- Install by running
npm install standard --global - Run
standardto check all JavaScript files - Run
standard --fixto auto-correct offenses - How do I run StandardJS in my editor?
- How do I make the output more readable?
We use Typos as a spell checker.
- Install by running
brew install typos-cli - Run
typosto check all files - Run
typos -wto auto-correct offenses - For false positives and other configuration, see the
_typos.ymlfile
Leftook will execute the linters' auto-fix on staged files and abort the commit if there are offenses that can't be auto-fixed. Run the following commands to enable this flow:
gem install lefthook
lefthook install
Besides code reviews, we use rubycritic to generate a report of the code quality. Both as a reviewer and as a contributor, you should check the report and address the issues found if the files you are working on have a low score ("D" or "F").
- You can run it with
bundle exec rubycritic
We use DatabaseConsistency to check for inconsistencies between the database schema and the application models.
- You can run it with
bundle exec database_consistency.
Run tests by using bundle exec rspec.
- Headless is the default config. If you want to see the browser you can run the following command:
HEADLESS=false bundle exec rspec - If you want to pause the execution you can use
pauseinside anitstatement. - If you want to see the logs you can use
:log, e.g.it "xxx", :log do - Use
data-test-idto find elements instead of classes/ids, e.g.data-test-id="decline_modal" - Use the methods in the
DataTestIdmodule to select HTML elements, e.g.,find_dti("decline_modal")
Use ENV variables to enable features, the name should follow the convention "#{feature_name}_ENABLED". For example, to enable the payment feature, use ENV["PAYMENT_ENABLED"]="true".