-
Notifications
You must be signed in to change notification settings - Fork 0
/
rules.yml
32 lines (30 loc) · 1002 Bytes
/
rules.yml
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
rules:
- id: require_include_in_schema
languages:
- python
severity: ERROR
message: Found a route that doesn't explicitly set include_in_schema.
patterns:
- pattern-inside: |
$ROUTER = ninja.Router(...)
...
- pattern: $ROUTER.$OPERATION(...)
- pattern-not: $ROUTER.$OPERATION(..., include_in_schema=..., ...)
- metavariable-regex:
metavariable: $OPERATION
regex: ^(get|post|delete|put|patch)$
- id: require-delay-on-commit
languages:
- python
severity: ERROR
message: Found a call to a celery task that runs before transaction commit.
pattern: $TASK.delay($...ARGS)
fix: $TASK.delay_on_commit($...ARGS)
- id: require-celery-timeouts
languages:
- python
severity: ERROR
message: Found a celery task definition that doesn't set timeouts.
patterns:
- pattern: shared_task(...)
- pattern-not: shared_task(..., soft_time_limit=..., time_limit=..., ...)