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
Copy file name to clipboardExpand all lines: .cursor/rules/general/general.mdc
+29-14Lines changed: 29 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,12 @@
1
+
# (C) 2025 GoodData Corporation
1
2
---
2
3
alwaysApply: true
3
4
---
4
5
5
6
# GoodData Python SDK Coding Guidelines
6
7
7
8
Applies to all packages and code in this Python SDK workspace.
8
-
Think in steps before changes. Search for relevant cursor rules based on the character of changes.
9
+
Think in steps before changes. Always search for relevant cursor rules based on the character of changes.
9
10
10
11
## Core Principles
11
12
@@ -15,11 +16,17 @@ Think in steps before changes. Search for relevant cursor rules based on the cha
15
16
16
17
## ⚠️ CRITICAL: AI Behavior Rules - ALWAYS ENFORCE
17
18
18
-
**NO AUTO-IMPLEMENTATION**:
19
+
**NO AUTO-IMPLEMENTATION**:
20
+
- Do not generate, rename or refactor what is not explicitly requested
19
21
- Do not generate code changes unless user explicitly asks for it
20
-
- NEVER create summary/documentation markdown files unless explicitly requested
22
+
- NEVER create summary/documentation markdown files unless user explicitly requests it
23
+
- NEVER update rule files for code issues - fix the code instead
21
24
- Break complex tasks into smaller deliverable units
22
25
26
+
**Documentation Quality**:
27
+
- NEVER reference specific line numbers (e.g., "lines 45-340", "~line 60") in documentation or Cursor rules
28
+
- Use descriptive structural locations instead (e.g., "in the outputs section", "at the top of the file")
29
+
23
30
**For complex tasks**:
24
31
1. Implement ONLY the first task, then STOP
25
32
2. Ask permission to continue, offering: (a) next task only, or (b) all remaining tasks
@@ -28,20 +35,23 @@ Think in steps before changes. Search for relevant cursor rules based on the cha
28
35
29
36
## Code Validation
30
37
31
-
**If gdc-ruler MCP server is available**: Use `validate_python` tool with this workspace path.
32
-
```
33
-
validate_python(path=".") # From workspace root
34
-
```
35
-
36
-
**Otherwise**: Run manually:
38
+
**MANDATORY after code changes**: Run validation from workspace root:
37
39
```bash
38
-
make format-fix && make mypy && make test
40
+
make format-fix && make lint && make mypy && make test
39
41
```
40
42
43
+
**⚠️ CRITICAL: Do NOT use `read_lints` tool**:
44
+
- `read_lints` is incompatible with our custom linting - it will fail
45
+
- Use manual validation commands above
46
+
41
47
**Scoped testing**: `TEST_ENVS=py312 ADD_ARGS="-k test_name" make test`
42
48
43
49
See `technologies/testing` rule for VCR cassette workflow.
44
50
51
+
## Testing Practices
52
+
53
+
**Extend existing tests, don't create new ones**: When making incremental changes (new property, enum value, field), add to existing test fixtures rather than creating new tests.
54
+
45
55
## Package Structure
46
56
47
57
**Workspace packages** (in `packages/`):
@@ -61,10 +71,15 @@ See `technologies/testing` rule for VCR cassette workflow.
61
71
62
72
## OpenAPI Client Generation
63
73
64
-
**DO NOT manually edit** generated client code in `gooddata-*-client/` directories.
74
+
**DO NOT manually edit** generated client code in `gooddata-api-client/` directories.
75
+
76
+
To regenerate: `make api-client`
65
77
66
-
See `.openapi-generator/README.md` for regeneration instructions.
**Use absolute imports only.** Relative imports break IDE navigation.
15
16
```python
16
17
from gooddata_sdk.client import GoodDataSdk # ✅
17
18
from .client import GoodDataSdk # ❌
18
19
```
19
20
20
-
**All imports at top of file.** After docstring and `from __future__ import annotations`.
21
-
22
-
## Type-first Habits
21
+
**All imports must be at the top of the file.** Never import modules inside functions or in the middle of code. All `import` and `from ... import` statements must be placed at the top of the file, after the module docstring and `from __future__ import annotations` if present.
23
22
23
+
## Type-first habits
24
24
- Every def + local (esp empty list/dict/set) annotated; dataclasses fully typed.
25
25
- Use `from __future__ import annotations` for forward references.
26
-
- Guard external data (YAML/JSON) as `Any` then narrow types.
27
-
28
-
## External Data (YAML/JSON)
29
-
30
-
```python
31
-
raw = yaml.safe_load(handle)
32
-
if not isinstance(raw, dict):
33
-
raise ValueError("expected mapping")
34
-
cfg: dict[str, object] = {str(k): v for k, v in raw.items()}
35
-
```
36
-
37
-
## Casts / Guards
38
-
39
-
- Single authoritative `cast(...)` + reuse variable
0 commit comments