File tree Expand file tree Collapse file tree 16 files changed +135
-0
lines changed Expand file tree Collapse file tree 16 files changed +135
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
<!-- Add all new changes here. They will be moved under a version at release -->
5
+ ` 2025-3-13 `
6
+ * ` NEW ` ` unnecessary-assert ` diagnostic warns when asserting values that are always truthy
5
7
* ` NEW ` locale ` es-419 ` , thanks [ Felipe Lema] ( https://codeberg.org/FelipeLema )
6
8
7
9
## 3.13.9
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS =
36
36
' This function expects a maximum of {:d} argument(s) but instead it is receiving {:d}.'
37
37
DIAG_MISS_ARGS =
38
38
' This function requires {:d} argument(s) but instead it is receiving {:d}.'
39
+ DIAG_UNNECESSARY_ASSERT =
40
+ ' Unnecessary assert: this expression is always truthy.'
39
41
DIAG_OVER_MAX_VALUES =
40
42
' Only has {} variables, but you set {} values.'
41
43
DIAG_AMBIGUITY_1 =
Original file line number Diff line number Diff line change @@ -406,6 +406,8 @@ config.diagnostics['missing-return-value'] =
406
406
' Enable diagnostics for return statements without values although the containing function declares returns.'
407
407
config .diagnostics [' need-check-nil' ] =
408
408
' Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before.'
409
+ config .diagnostics [' unnecessary-assert' ] =
410
+ ' Enable diagnostics for redundant assertions on truthy values.'
409
411
config .diagnostics [' no-unknown' ] =
410
412
' Enable diagnostics for cases in which the type cannot be inferred.'
411
413
config .diagnostics [' not-yieldable' ] =
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS =
36
36
' この関数は最大で {:d} 個の引数を受け取りますが、{:d} 個の引数が渡されています。'
37
37
DIAG_MISS_ARGS =
38
38
' この関数は少なくとも {:d} 個の引数を必要としますが、{:d} 個しか渡されていません。'
39
+ DIAG_UNNECESSARY_ASSERT =
40
+ ' 不要なアサーション: この式は常に真です。'
39
41
DIAG_OVER_MAX_VALUES =
40
42
' 変数は {} 個しかありませんが、{} 個の値が設定されています。'
41
43
DIAG_AMBIGUITY_1 =
Original file line number Diff line number Diff line change @@ -406,6 +406,8 @@ config.diagnostics['missing-return-value'] = -- TODO: need translate!
406
406
' Enable diagnostics for return statements without values although the containing function declares returns.'
407
407
config .diagnostics [' need-check-nil' ] = -- TODO: need translate!
408
408
' Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before.'
409
+ config .diagnostics [' unnecessary-assert' ] = -- TODO: need translate!
410
+ ' Enable diagnostics for redundant assertions on truthy values.'
409
411
config .diagnostics [' no-unknown' ] = -- TODO: need translate!
410
412
' Enable diagnostics for cases in which the type cannot be inferred.'
411
413
config .diagnostics [' not-yieldable' ] = -- TODO: need translate!
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS =
36
36
' A função aceita apenas os parâmetros {:d}, mas você passou {:d}.'
37
37
DIAG_MISS_ARGS =
38
38
' A função recebe pelo menos {:d} argumentos, mas há {:d}.'
39
+ DIAG_UNNECESSARY_ASSERT =
40
+ ' Asserção desnecessária: esta expressão é sempre verdadeira.'
39
41
DIAG_OVER_MAX_VALUES =
40
42
' Apenas há {} variáveis, mas você declarou {} valores.'
41
43
DIAG_AMBIGUITY_1 =
Original file line number Diff line number Diff line change @@ -406,6 +406,8 @@ config.diagnostics['missing-return-value'] = -- TODO: need translate!
406
406
' Enable diagnostics for return statements without values although the containing function declares returns.'
407
407
config .diagnostics [' need-check-nil' ] = -- TODO: need translate!
408
408
' Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before.'
409
+ config .diagnostics [' unnecessary-assert' ] = -- TODO: need translate!
410
+ ' Enable diagnostics for redundant assertions on truthy values.'
409
411
config .diagnostics [' no-unknown' ] = -- TODO: need translate!
410
412
' Enable diagnostics for cases in which the type cannot be inferred.'
411
413
config .diagnostics [' not-yieldable' ] = -- TODO: need translate!
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS =
36
36
' 函数最多接收 {:d} 个参数,但获得了 {:d} 个。'
37
37
DIAG_MISS_ARGS =
38
38
' 函数最少接收 {:d} 个参数,但获得了 {:d} 个。'
39
+ DIAG_UNNECESSARY_ASSERT =
40
+ ' 不必要的断言:此表达式始终为真值。'
39
41
DIAG_OVER_MAX_VALUES =
40
42
' 只有 {} 个变量,但你设置了 {} 个值。'
41
43
DIAG_AMBIGUITY_1 =
Original file line number Diff line number Diff line change @@ -404,6 +404,8 @@ config.diagnostics['missing-return-value'] =
404
404
' 函数无值返回但函数使用`@return`标记了返回值'
405
405
config .diagnostics [' need-check-nil' ] =
406
406
' 变量之前被赋值为`nil`或可选值(可能为 `nil`)'
407
+ config .diagnostics [' unnecessary-assert' ] =
408
+ ' 启用对冗余断言(针对始终为真值的表达式)的诊断'
407
409
config .diagnostics [' no-unknown' ] =
408
410
' 变量的未知类型无法推断'
409
411
config .diagnostics [' not-yieldable' ] =
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS =
36
36
' 函式最多接收 {:d} 個引數,但獲得了 {:d} 個。'
37
37
DIAG_MISS_ARGS =
38
38
' 函式最少接收 {:d} 個引數,但獲得了 {:d} 個。'
39
+ DIAG_UNNECESSARY_ASSERT =
40
+ ' 不必要的斷言:此表達式始終為真值。'
39
41
DIAG_OVER_MAX_VALUES =
40
42
' 只有 {} 個變數,但你設定了 {} 個值。'
41
43
DIAG_AMBIGUITY_1 =
You can’t perform that action at this time.
0 commit comments