forked from tailcallhq/forgecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforge.yaml
More file actions
72 lines (61 loc) · 2.78 KB
/
forge.yaml
File metadata and controls
72 lines (61 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
variables:
mode: ACT
commands:
- name: fixme
description: Looks for all the fixme comments in the code and attempts to fix them
prompt: Find all the FIXME comments in source-code files and attempt to fix them.
- name: pr-description
description: Updates the description of the PR
prompt: |-
- I have created a Pull Request with all the accepted changes
- Understand the current PR deeply using the GH CLI and update the PR title and description
- Make sure the title follows conventional commits standard
- Top-level summary should contain 2-3 lines about the core functionality improvements
- name: check
description: Checks if the code is ready to be committed
prompt: |-
- Run the `lint` and `test` commands and verify if everything is fine.
<lint>cargo +nightly fmt --all; cargo +nightly clippy --fix --allow-staged --allow-dirty --workspace</lint>
<test>cargo insta test --accept --unreferenced=delete</test>
- Fix every issue found in the process
model: anthropic/claude-sonnet-4
max_walker_depth: 1024
custom_rules: |-
Handling Errors:
- Use `anyhow::Result` for error handling in services and repositories.
- Create domain errors using `thiserror`.
- Never implement `From` for converting domain errors, manually convert them
Writing Tests:
- All tests should be written in three discrete steps:
```rust
use pretty_assertions::assert_eq; // Always use pretty assertions
fn test_foo() {
let fixture = ...; // Instantiate a fixture for the test
let actual = ...; // Execute the fixture to create an output
let expected = ...; // Define a hand written expected result
assert_eq!(actual, expected); // Assert that the actual result matches the expected result
}
```
- Use `pretty_assertions` for better error messages.
- Use fixtures to create test data.
- Use `assert_eq!` for equality checks.
- Use `assert!(...)` for boolean checks.
- Use unwraps in test functions and anyhow::Result in fixtures.
- Keep the boilerplate to a minimum.
- Use words like `fixture`, `actual` and `expected` in test functions.
- Fixtures should be generic and reusable.
- Test should always be written in the same file as the source code.
Running Tests:
- We use `insta` to run tests:
```
cargo insta test --accept --unreferenced=delete
```
Verification:
- run the following command to format and validate if the code is working:
```
cargo +nightly fmt --all; cargo +nightly clippy --fix --allow-staged --allow-dirty --workspace;
```
Writing Domain Types:
- Use `derive_setters` to derive setters and use the `strip_option` and the `into` attributes on the struct types.
Refactoring:
- If asked to fix failing tests, always confirm whether to update the implementation or the tests.