Skip to content

Commit

Permalink
chore: Add amount access check to pre-commit.
Browse files Browse the repository at this point in the history
Reimplements `make check-amount-access` for Python regex.
  • Loading branch information
s373nZ committed Dec 16, 2024
1 parent d9ec630 commit 24b0339
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@ repos:
hooks:
- id: shellcheck
args: [ -fgcc ]

- repo: local
hooks:
# Reimplementation of `make check-amount-access` for pygrep.
- id: check-amount-access
name: Check amount_msat and amount_sat members are not accessed directly
description: "Don't access amount_msat and amount_sat members directly without a good reason since it risks overflow."
language: pygrep
entry: (->|\.)(milli)?satoshis(?!.*\/\*\ Raw:)|(?<!sizeof)\(struct\ amount_(m)?sat\)
types: [ c ]
exclude: common/amount|(.*)/test/(.*)

0 comments on commit 24b0339

Please sign in to comment.