ci: rule to fail PRs that add a new manual commit (#27928)
Manual commits are frequent source of bugs, confusions or undefined behaviour. All new manual commits should be explcitly ignored with explanation on why it's added. This will only fail for new additions. Existing ones need to be cleaned up manually.
This commit is contained in:
parent
b6da7ff1b1
commit
06b426e9c3
@ -131,3 +131,21 @@ rules:
|
|||||||
key `$X` is uselessly assigned twice. This could be a potential bug.
|
key `$X` is uselessly assigned twice. This could be a potential bug.
|
||||||
languages: [python]
|
languages: [python]
|
||||||
severity: ERROR
|
severity: ERROR
|
||||||
|
|
||||||
|
|
||||||
|
- id: frappe-manual-commit
|
||||||
|
patterns:
|
||||||
|
- pattern: frappe.db.commit()
|
||||||
|
- pattern-not-inside: |
|
||||||
|
try:
|
||||||
|
...
|
||||||
|
except ...:
|
||||||
|
...
|
||||||
|
message: |
|
||||||
|
Manually commiting a transaction is highly discouraged. Read about the transaction model implemented by Frappe Framework before adding manual commits: https://frappeframework.com/docs/user/en/api/database#database-transaction-model If you think manual commit is required then add a comment explaining why and `// nosemgrep` on the same line.
|
||||||
|
paths:
|
||||||
|
exclude:
|
||||||
|
- "**/patches/**"
|
||||||
|
- "**/demo/**"
|
||||||
|
languages: [python]
|
||||||
|
severity: ERROR
|
||||||
|
Loading…
Reference in New Issue
Block a user