AdguardTeam / AdguardTeam/AGLint
Add rule for detecting invalid logical expressions
- Linguagem predominante
- TypeScript
- Estrelas
- 71
- Forks
- 4
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
We should check conditions in `if` preprocessor directive.
A logical expression can be invalid if it is contradictory or always produces the same result regardless of the input. Here are some examples:
### 1. **Self-Contradiction**
- `(A && !A)`
- This states that "A is true and A is not true" simultaneously, which is logically impossible.
### 2. **Redundancy**
- `(A || A)`
- This always produces the same result as `A`. One of the conditions is unnecessary.
### 3. **Unnecessary Expressions**
- `(A && true)` or `(A || false)`
- Such expressions are not logically invalid but redundant, as `true` or `false` does not change the outcome.
### 4. **Always True (Tautology)**
- `(A || !A)`
- This is always true because either `A` is true, or `A` is not true (this is an axiom).
### 5. **Disconnected Conditions**
- `(A && B && !B)`
- Here, `B` and `!B` exclude each other, so the entire expression will always be false, regardless of the value of `A`.
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.