|
| 1 | +# stripe-ruby |
| 2 | + |
| 3 | +## Testing |
| 4 | + |
| 5 | +- Run all tests: `just test` |
| 6 | +- Tests use Rake (`bundle exec rake test`) |
| 7 | +- Typecheck: `just typecheck` (Sorbet, requires Ruby >= 2.7) |
| 8 | + |
| 9 | +## Formatting & Linting |
| 10 | + |
| 11 | +- Format: `just format` (uses rubocop with auto-correct) |
| 12 | +- Lint check: `just format-check` (rubocop without auto-correct) |
| 13 | + |
| 14 | +## Key Locations |
| 15 | + |
| 16 | +- Main client (HTTP requests, headers, auth): `lib/stripe/stripe_client.rb` |
| 17 | +- Connection management: `lib/stripe/connection_manager.rb` |
| 18 | +- Version: `lib/stripe/version.rb` |
| 19 | +- Sorbet type definitions: `rbi/`. NEVER read `rbi/stripe.rbi`, since it's a huge file that collects data already present in other `.rbi` files |
| 20 | + |
| 21 | +## Generated Code |
| 22 | + |
| 23 | +- Files containing `File generated from our OpenAPI spec` at the top are generated; do not edit. Similarly, any code block starting with `The beginning of the section generated from our OpenAPI spec` is generated and should not be edited directly. |
| 24 | + - If something in a generated file/range needs to be updated, add a summary of the change to your report but don't attempt to edit it directly. |
| 25 | +- Resource classes under `lib/stripe/resources/` are largely generated. |
| 26 | +- `stripe_client.rb`, `connection_manager.rb`, and core infrastructure files are NOT generated. |
| 27 | + |
| 28 | +## Conventions |
| 29 | + |
| 30 | +- Uses Ruby's standard `Net::HTTP` library |
| 31 | +- Bundler for gem management |
| 32 | +- Rubocop for style enforcement |
| 33 | +- Sorbet for optional type checking |
| 34 | +- Work is not complete until `just test` and `just typecheck` complete successfully. |
| 35 | +- All code must run on all supported Ruby versions (full list in the test section of @.github/workflows/ci.yml) |
| 36 | + |
| 37 | +### Comments |
| 38 | + |
| 39 | +- Comments MUST only be used to: |
| 40 | + 1. Document a function |
| 41 | + 2. Explain the WHY of a piece of code |
| 42 | + 3. Explain a particularly complicated piece of code |
| 43 | +- Comments NEVER should be used to: |
| 44 | + 1. Say what used to be there. That's no longer relevant! |
| 45 | + 2. Explain the WHAT of a piece of code (unless it's very non-obvious) |
| 46 | + |
| 47 | +It's ok not to put comments on/in a function if their addition wouldn't meaningfully clarify anything. |
0 commit comments