Skip to content

Commit 47721ae

Browse files
committed
feat: cursor rules for code review
Signed-off-by: Junaid Rahim <[email protected]>
1 parent c0ffad4 commit 47721ae

File tree

4 files changed

+107
-53
lines changed

4 files changed

+107
-53
lines changed

.cursor/rules/code-review.mdc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
description: When asked to perform a code review for a module, class or function.
3+
globs:
4+
alwaysApply: false
5+
---
6+
# Code Review Guidelines
7+
8+
When asked to perform a code review for a module, class or function.
9+
10+
## Code Style
11+
12+
Ensure the code adheres to the development standards outlined in [standards.mdc](mdc:.cursor/rules/standards.mdc):
13+
14+
15+
## Tests
16+
17+
All code changes must include appropriate tests as defined in [testing.mdc](mdc:.cursor/rules/testing.mdc):
18+
19+
20+
## Documentation
21+
22+
Verify documentation standards from [standards.mdc](mdc:.cursor/rules/standards.mdc) and [documentation.mdc](mdc:.cursor/rules/documentation.mdc):
23+
24+
25+
## API Semantics
26+
27+
- **Interface Design**
28+
- Clear and consistent API contracts
29+
- Proper input validation and output formatting
30+
- Backward compatibility considerations
31+
- Appropriate HTTP status codes and responses
32+
33+
- **Data Flow**
34+
- Proper handling of inputs, transformations, and outputs
35+
- Validation of data at boundaries
36+
- Consistent data structures and formats
37+
38+
## Contributing Guide
39+
40+
Please ensure the change adheres to the pull request guidelines in [CONTRIBUTING.md](mdc:CONTRIBUTING.md):
41+
42+
## Review Checklist
43+
44+
- Code follows [standards.mdc](mdc:.cursor/rules/standards.mdc) style guidelines
45+
- Tests follow [testing.mdc](mdc:.cursor/rules/testing.mdc) requirements
46+
- Logging uses [logging.mdc](mdc:.cursor/rules/logging.mdc) standards
47+
- Documentation is updated per [documentation.mdc](mdc:.cursor/rules/documentation.mdc)
48+
- PR follows [CONTRIBUTING.md](mdc:CONTRIBUTING.md) guidelines
49+
- Security considerations addressed
50+
- Performance implications considered
51+
- Resource management properly handled
52+
- Error handling is comprehensive
53+
- API contracts are clear and consistent
54+
55+
Refer to the [CONTRIBUTING.md](mdc:CONTRIBUTING.md) for guidelines for contributors

.cursor/rules/documentation.mdc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ globs: application_sdk/**/*.py
44
alwaysApply: false
55
---
66
Update conceptual documentation when SDK code changes.
7-
A file within the Application SDK has been modified: `{trigger_file_path}`.
7+
A file within the Application SDK has been modified: `{trigger_file_path}`.
88

9-
**Action Required:** Please review the changes in this file and update the corresponding conceptual documentation under `docs/docs/concepts/` to ensure it accurately reflects the current code. Keeping documentation synchronized with the code is crucial for maintainability.
9+
**Action Required:** Please review the changes in this file and update the corresponding conceptual documentation under `docs/docs/concepts/` to ensure it accurately reflects the current code. Keeping documentation synchronized with the code is crucial for maintainability.
1010

11-
**Module to Concept Doc Mapping:**
11+
**Module to Concept Doc Mapping:**
1212
* `application_sdk/application/**` -> `docs/docs/concepts/application.md` (Covers both simple and specialized workflow applications. The `BaseApplication` class is the generic entry point for all workflow-driven applications.)
1313
* `application_sdk/server/**` -> `docs/docs/concepts/server.md` (Covers server abstractions, FastAPI integration, and API endpoint patterns.)
1414
* `application_sdk/handlers/**` -> `docs/docs/concepts/handlers.md` (Covers handler interfaces and custom handler logic.)
@@ -22,4 +22,4 @@ Update conceptual documentation when SDK code changes.
2222
* `application_sdk/worker.py` -> `docs/docs/concepts/worker.md` (Covers worker orchestration and Temporal worker management.)
2323
* `docs/docs/concepts/application_sql.md` -> Specialized SQL workflow application patterns and examples.
2424

25-
*(Note: Carefully examine the code changes to determine the exact impact and which documentation file(s) require updates. For application changes, review both simple and specialized application patterns.)*
25+
*(Note: Carefully examine the code changes to determine the exact impact and which documentation file(s) require updates. For application changes, review both simple and specialized application patterns.)*

.cursor/rules/logging.mdc

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
---
2-
description:
3-
globs: application_sdk/**/*.py
2+
description: When asked to add or improve logs for a given module or file.
3+
globs:
44
alwaysApply: false
55
---
66
# Logging Guidelines
77

8-
- **Logger Configuration**
9-
- Use `AtlanLoggerAdapter` for all logging
10-
- Configure loggers using `get_logger(__name__)`
11-
- Use structured logging with context
12-
- Include request IDs in logs
13-
- Use appropriate log levels:
14-
- DEBUG: Detailed information for debugging
15-
- INFO: General operational information
16-
- WARNING: Warning messages for potential issues
17-
- ERROR: Error messages for recoverable errors
18-
- CRITICAL: Critical errors that may cause system failure
19-
- ACTIVITY: Activity-specific logging
20-
21-
- **Log Format**
22-
```python
23-
"<green>{time:YYYY-MM-DD HH:mm:ss}</green> <blue>[{level}]</blue> <cyan>{extra[logger_name]}</cyan> - <level>{message}</level>"
24-
```
25-
26-
- **Logging Best Practices**
27-
- Include relevant context in log messages
28-
- Use structured logging for machine processing
29-
- Log exceptions with stack traces
30-
- Include request IDs in distributed systems
31-
- Use appropriate log levels
32-
- Avoid logging sensitive information
33-
- Include workflow and activity context in Temporal workflows
34-
35-
- **Example Usage**
36-
```python
37-
from application_sdk.observability.logger_adaptor import get_logger
38-
39-
logger = get_logger(__name__)
40-
41-
# Basic logging
42-
logger.info("Operation completed successfully")
43-
44-
# Logging with context
45-
logger.info("Processing request", extra={"request_id": "123", "user": "john"})
46-
47-
# Error logging
48-
try:
49-
# Some operation
50-
pass
51-
except Exception as e:
52-
logger.error("Operation failed", exc_info=True)
53-
```
8+
This rule establishes standardized logging practices for the Application SDK using `AtlanLoggerAdapter`.
9+
10+
## Logger Configuration
11+
12+
- Always configure loggers using the `get_logger(__name__)` function in `application_sdk.observability.logger_adaptor.py` for all logging needs.
13+
- This creates a `AtlanLoggerAdapter` singleton instance that can used multiple times.
14+
- Use structured logging with context
15+
- Include request IDs in logs
16+
- Use appropriate log levels:
17+
- DEBUG: Detailed information for debugging
18+
- INFO: General operational information
19+
- WARNING: Warning messages for potential issues
20+
- ERROR: Error messages for recoverable errors
21+
- CRITICAL: Critical errors that may cause system failure
22+
- ACTIVITY: Activity-specific logging
23+
24+
## Logging Best Practices
25+
26+
- Include relevant context in log messages
27+
- Use structured logging for machine processing
28+
- Log exceptions with stack traces
29+
- Include request IDs in distributed systems
30+
- Use appropriate log levels
31+
- Avoid logging sensitive information
32+
- Include workflow and activity context in Temporal workflows
33+
34+
## Example Usage
35+
36+
```python
37+
from application_sdk.observability.logger_adaptor import get_logger
38+
39+
logger = get_logger(__name__)
40+
41+
# Basic logging
42+
logger.info("Operation completed successfully")
43+
44+
# Logging with context
45+
logger.info("Processing request", extra={"request_id": "123", "user": "john"})
46+
47+
# Error logging
48+
try:
49+
# Some operation
50+
pass
51+
except Exception as e:
52+
logger.error("Operation failed", exc_info=True)
53+
```

.cursor/rules/testing.mdc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ alwaysApply: false
77

88
- Run the unit tests using the command: `uv run pytests tests/`
99

10-
1110
- **Test Framework**
1211
- Write tests before fixing bugs
1312
- Keep tests readable and maintainable

0 commit comments

Comments
 (0)