Skip to content

Commit cc8f55e

Browse files
author
AI Developer
committed
Add critical rule: never silence warnings, always check ruff docs for fixes
- code-quality: add section about checking ruff docs for proper fixes - tdd: add section about handling lint warnings properly - Example: RUF069 → use math.isclose() instead of noqa
1 parent 9174322 commit cc8f55e

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

{{cookiecutter.project_slug}}/.opencode/skills/code-quality/SKILL.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,25 @@ jobs:
264264
265265
### 8. Quality Issue Resolution
266266
267+
#### CRITICAL: Never Silence Warnings with noqa
268+
**Golden Rule**: When ruff reports an issue, ALWAYS check the documentation to understand how to fix it properly. Never use `noqa` comments to silence warnings.
269+
270+
For any ruff rule (like RUF069, F841, etc.):
271+
1. Look up the rule at https://docs.astral.sh/ruff/rules/
272+
2. Read the "How to fix" section
273+
3. Apply the proper solution
274+
4. Only use noqa as a last resort when no proper fix exists
275+
276+
Example workflow for RUF069 (float-equality-comparison):
277+
```bash
278+
# WRONG - just silencing the warning
279+
assert value == 10.0 # noqa: RUF069
280+
281+
# RIGHT - using math.isclose() as per ruff docs
282+
import math
283+
assert math.isclose(value, 10.0, abs_tol=1e-9)
284+
```
285+
267286
#### Common Ruff Issues and Fixes
268287
```python
269288
# Issue: ANN001 - Missing type hint for function argument

{{cookiecutter.project_slug}}/.opencode/skills/tdd/SKILL.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,24 @@ For complete test patterns and guidelines, see:
3838
3. **Refactor** (REFACTOR phase)
3939
- Improve code while keeping tests green
4040

41+
## CRITICAL: Handle Lint Warnings Properly
42+
43+
When writing tests, ruff may report issues like RUF069 (float-equality-comparison).
44+
45+
**NEVER use noqa to silence warnings.** Instead:
46+
1. Check the rule at https://docs.astral.sh/ruff/rules/<RULE_CODE>/
47+
2. Apply the proper fix from the "How to fix" section
48+
49+
Example for RUF069 (float-equality):
50+
```python
51+
# WRONG - silencing
52+
assert bond.amount_usdt == 10.0 # noqa: RUF069
53+
54+
# RIGHT - using math.isclose()
55+
import math
56+
assert math.isclose(bond.amount_usdt, 10.0, abs_tol=1e-9)
57+
```
58+
4159
## Running Tests
4260

4361
```bash

0 commit comments

Comments
 (0)