You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 30, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: apps/nextra/pages/en/build/smart-contracts/linter.mdx
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,27 @@ Checks for patterns where a variable or a field of a struct is assigned to itsel
101
101
-`x = x;`
102
102
-`a.x = a.x;`
103
103
104
+
### `simpler_bool_expression`
105
+
106
+
Checks for boolean patterns that can be simplified through different boolean algebra laws. Examples include:
107
+
- Absorption law:
108
+
-`a && b || a` can be simplified to `a`
109
+
-`a || a && b` can be simplified to `a`
110
+
- Idempotence:
111
+
-`a && a` can be simplified to `a`
112
+
-`a || a` can be simplified to `a`
113
+
- Contradiction
114
+
-`a && !a` can be simplified to `false`
115
+
-`!a && a` can be simplified to `false`
116
+
- Tautology:
117
+
-`a || !a` can be simplified to `true`
118
+
-`!a || a` can be simplified to `true`
119
+
- Distributive law:
120
+
-`(a && b) || (a && c)` can be simplified to `a && (b || c)`
121
+
-`(a || b) && (a || c)` can be simplified to `a || (b && c)`
122
+
123
+
Where `a`, `b` and `c` can either be simple or composed expressions.
124
+
104
125
### `simpler_numeric_expression`
105
126
106
127
Checks for various patterns where a simpler numeric expression can be used instead. In all these cases, the code must already type check, and `x` can be any numeric expression.
0 commit comments