You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Check for hardcoded secrets, API keys, or credentials
7
+
- Check for instances of potential method call injection, dynamic code execution, symbol injection or other code injection vulnerabilities.
8
+
9
+
## Performance Red Flags
10
+
- Spot inefficient loops and algorithmic issues.
11
+
- Check for memory leaks and resource cleanup.
12
+
13
+
## Code Quality Essentials
14
+
- Methods should be focused and appropriately sized. If a method is doing too much, suggest refactorings to split it up.
15
+
- Use clear, descriptive naming conventions.
16
+
- Avoid encapsulation violations and ensure proper separation of concerns.
17
+
- All public classes, modules, and methods should have clear documentation in YARD format.
18
+
- If `method_missing` is implemented, ensure that `respond_to_missing?` is also implemented.
19
+
- Rubocop is used by this project to enforce code style. Always refer to the project's .rubocop.yml file for guidance on the project's style preferences.
20
+
21
+
## Driver-specific Concerns
22
+
- Look for code that might cause issues in a multi-threaded (or multi-fiber) environment.
23
+
24
+
## Review Style
25
+
- Be specific and actionable in feedback
26
+
- Explain the "why" behind recommendations
27
+
- Acknowledge good patterns when you see them
28
+
- Ask clarifying questions when code intent is unclear
29
+
- When possible, suggest that the pull request be labeled as a `bug`, a `feature`, or a `bcbreak` (a "backwards-compatibility break").
30
+
- PR's with no user-visible effect do not need to be labeled.
31
+
- Do not review or suggest changes to YAML files under the `spec/` directory; these are test fixtures shared between all drivers and are not owned by this repository.
32
+
- Flag any new Ruby specs that appear to duplicate behavior already covered by YAML spec tests in `spec/spec_tests/data/`.
33
+
34
+
Always prioritize security vulnerabilities and performance issues that could impact users.
35
+
36
+
Always suggest changes to improve readability and testability.
This is the Ruby driver for the MongoDB database. It provides a Ruby interface for connecting to MongoDB, performing CRUD operations, and managing database connections. The API is standardized across all MongoDB drivers, via the specifications defined in the MongoDB Specifications repository: https://github.com/mongodb/specifications.
3
+
This is the Ruby driver for the MongoDB database. It provides a Ruby interface for connecting to MongoDB, performing CRUD operations, and managing database connections. The API is standardized across all MongoDB drivers, via the specifications defined in the MongoDB Specifications repository: https://github.com/mongodb/specifications. The driver targets Ruby 2.7+. Do not use syntax or stdlib features unavailable in Ruby 2.7.
4
4
5
5
# Project Structure
6
6
@@ -14,41 +14,53 @@ The project is organized into the following directories:
14
14
-`profile/`: profiling scripts and results
15
15
16
16
17
-
# Code Reviews
17
+
# Development Workflow
18
+
19
+
## Running tests
20
+
21
+
Tests require a running MongoDB instance. Set the URI via the `MONGODB_URI` environment variable:
- Check for hardcoded secrets, API keys, or credentials
23
-
- Check for instances of potential method call injection, dynamic code execution, symbol injection or other code injection vulnerabilities.
39
+
RuboCop is configured with performance, rake, and rspec plugins (`.rubocop.yml`).
24
40
25
-
## Performance Red Flags
26
-
- Spot inefficient loops and algorithmic issues.
27
-
- Check for memory leaks and resource cleanup.
41
+
## Commit convention
28
42
29
-
## Code Quality Essentials
30
-
- Methods should be focused and appropriately sized. If a method is doing too much, suggest refactorings to split it up.
31
-
- Use clear, descriptive naming conventions.
32
-
- Avoid encapsulation violations and ensure proper separation of concerns.
33
-
- All public classes, modules, and methods should have clear documentation in YARD format.
34
-
- If `method_missing` is implemented, ensure that `respond_to_missing?` is also implemented.
35
-
- Rubocop is used by this project to enforce code style. Always refer to the project's .rubocop.yml file for guidance on the project's style preferences.
43
+
Prefix commit messages with the JIRA ticket: `RUBY-#### Short description`. The ticket number is typically in the branch name (e.g., branch `3795-foo` means `RUBY-3795`).
36
44
37
-
## Driver-specific Concerns
38
-
- Look for code that might cause issues in a multi-threaded (or multi-fiber) environment.
45
+
## Prose style
39
46
40
-
## Review Style
41
-
- Be specific and actionable in feedback
42
-
- Explain the "why" behind recommendations
43
-
- Acknowledge good patterns when you see them
44
-
- Ask clarifying questions when code intent is unclear
45
-
- When possible, suggest that the pull request be labeled as a `bug`, a `feature`, or a `bcbreak` (a "backwards-compatibility break").
46
-
- PR's with no user-visible effect do not need to be labeled.
47
-
- Do not review YAML files under the `spec/` directory; these are test fixtures shared between all drivers.
47
+
When writing prose — commit messages, code comments, documentation — be concise, write as a human would, avoid overly complicated sentences, and use no emojis.
48
48
49
-
Always prioritize security vulnerabilities and performance issues that could impact users.
49
+
## Definition of done
50
50
51
-
Always suggest changes to improve readability and testability.
51
+
Always run the relevant spec file(s) against the local cluster before considering a task complete. Running tests is not optional. "Relevant" means: the spec file for each class you changed, plus any integration specs in `spec/integration/` that exercise the affected feature. If MongoDB is not reachable, report this to the user rather than trying to work around it.
52
52
53
-
Be encouraging.
53
+
## Thread and fiber safety
54
+
55
+
This driver runs in multi-threaded and multi-fiber environments. When writing or modifying code that touches connection pools, server monitors, or any shared state, always consider concurrent access. Use existing synchronization primitives in the codebase rather than introducing new ones.
56
+
57
+
## Spec fixtures
58
+
59
+
Unified test format YAML fixtures live in `spec/spec_tests/data/<suite_name>/`. To add new fixtures, copy YAML files from `specifications/source/<spec-name>/tests/unified/` into that directory. The runner loads all `*.yml` files automatically — no runner changes needed.
60
+
61
+
Do not write Ruby specs that duplicate behavior already covered by YAML spec tests. New Ruby specs should cover behavior that cannot be expressed in the unified test format.
62
+
63
+
64
+
# Code Reviews
54
65
66
+
See [.github/code-review.md](.github/code-review.md) for code review guidelines.
0 commit comments