Skip to content

sui_v1.33.0_1724442206_ci

@tx-tomcat tx-tomcat tagged this 23 Aug 17:49
## Description 
The lint identifies operations that have no effect on the result, such
as multiplying by 0 or 1, adding or subtracting 0, or shifting by 0.
These operations are considered redundant and can be simplified to
improve code clarity.

Main Logic:

For binary operations, it checks the operator and the right-hand side
operand.
It identifies specific patterns of meaningless operations.

Detected Patterns:
The lint checks for the following meaningless operations:

Multiplication or division by 0
Multiplication by 1
Addition or subtraction of 0
Left or right shift by 0

## Test plan
Added more use case including true positive, true negative, false
positive, false negative case

## Release notes

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [X] CLI: Move will now lint against unnecessary math operations in
many cases.
- [ ] Rust SDK:

---------

Co-authored-by: jamedzung <dung.dinhnguyen@digitalavenues.com>
Co-authored-by: Todd Nowacki <tmn@mystenlabs.com>
Assets 2
Loading