Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 098e260

Browse files
authored
Added docs for aborting_overflow_check lint (#975)
1 parent 242edb3 commit 098e260

File tree

1 file changed

+17
-0
lines changed
  • apps/nextra/pages/en/build/smart-contracts

1 file changed

+17
-0
lines changed

apps/nextra/pages/en/build/smart-contracts/linter.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ If you find any issues, please submit [bugs and feedback](https://github.com/apt
1212

1313

1414
## Lint Checks
15+
16+
### `aborting_overflow_checks`
17+
18+
Checks for patterns that look like overflow checks done in a C style:
19+
```move
20+
// Overflow check
21+
if (x > x + y) {
22+
abort 1;
23+
};
24+
25+
// Underflow check
26+
if (x < x - y) {
27+
abort 1;
28+
};
29+
```
30+
This pattern in Move does not make sense, as it either aborts immediately or is always true/false.
31+
1532
### `almost_swapped`
1633
Checks for expression patterns that look like a failed swap attempt and notifies the user. These patterns are likely erroneous code. This currently only detects simple access patterns such as assignments to a variable or a field of a struct. Examples include:
1734
- `a = b; b = a;` which can be correctly swapped with `(a, b) = (b, a);`

0 commit comments

Comments
 (0)