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 22
33## Unreleased  
44<!--  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
57
68## 3.13.9  
79` 2025-3-13 ` 
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS      =
3636' This function expects a maximum of {:d} argument(s) but instead it is receiving {:d}.' 
3737DIAG_MISS_ARGS           = 
3838' This function requires {:d} argument(s) but instead it is receiving {:d}.' 
39+ DIAG_UNNECESSARY_ASSERT  = 
40+ ' Unnecessary assert: this expression is always truthy.' 
3941DIAG_OVER_MAX_VALUES     = 
4042' Only has {} variables, but you set {} values.' 
4143DIAG_AMBIGUITY_1         = 
Original file line number Diff line number Diff line change @@ -406,6 +406,8 @@ config.diagnostics['missing-return-value']  =
406406' Enable diagnostics for return statements without values although the containing function declares returns.' 
407407config .diagnostics [' need-check-nil' = 
408408' 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.' 
409411config .diagnostics [' no-unknown' = 
410412' Enable diagnostics for cases in which the type cannot be inferred.' 
411413config .diagnostics [' not-yieldable' = 
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS      =
3636' この関数は最大で {:d} 個の引数を受け取りますが、{:d} 個の引数が渡されています。' 
3737DIAG_MISS_ARGS           = 
3838' この関数は少なくとも {:d} 個の引数を必要としますが、{:d} 個しか渡されていません。' 
39+ DIAG_UNNECESSARY_ASSERT  = 
40+ ' 不要なアサーション: この式は常に真です。' 
3941DIAG_OVER_MAX_VALUES     = 
4042' 変数は {} 個しかありませんが、{} 個の値が設定されています。' 
4143DIAG_AMBIGUITY_1         = 
Original file line number Diff line number Diff line change @@ -406,6 +406,8 @@ config.diagnostics['missing-return-value']  = -- TODO: need translate!
406406' Enable diagnostics for return statements without values although the containing function declares returns.' 
407407config .diagnostics [' need-check-nil' =  --  TODO: need translate!
408408' 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.' 
409411config .diagnostics [' no-unknown' =  --  TODO: need translate!
410412' Enable diagnostics for cases in which the type cannot be inferred.' 
411413config .diagnostics [' not-yieldable' =  --  TODO: need translate!
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS      =
3636' A função aceita apenas os parâmetros {:d}, mas você passou {:d}.' 
3737DIAG_MISS_ARGS           = 
3838' 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.' 
3941DIAG_OVER_MAX_VALUES     = 
4042' Apenas há {} variáveis, mas você declarou {} valores.' 
4143DIAG_AMBIGUITY_1         = 
Original file line number Diff line number Diff line change @@ -406,6 +406,8 @@ config.diagnostics['missing-return-value']  = -- TODO: need translate!
406406' Enable diagnostics for return statements without values although the containing function declares returns.' 
407407config .diagnostics [' need-check-nil' =  --  TODO: need translate!
408408' 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.' 
409411config .diagnostics [' no-unknown' =  --  TODO: need translate!
410412' Enable diagnostics for cases in which the type cannot be inferred.' 
411413config .diagnostics [' not-yieldable' =  --  TODO: need translate!
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS      =
3636' 函数最多接收 {:d} 个参数,但获得了 {:d} 个。' 
3737DIAG_MISS_ARGS           = 
3838' 函数最少接收 {:d} 个参数,但获得了 {:d} 个。' 
39+ DIAG_UNNECESSARY_ASSERT  = 
40+ ' 不必要的断言:此表达式始终为真值。' 
3941DIAG_OVER_MAX_VALUES     = 
4042' 只有 {} 个变量,但你设置了 {} 个值。' 
4143DIAG_AMBIGUITY_1         = 
Original file line number Diff line number Diff line change @@ -404,6 +404,8 @@ config.diagnostics['missing-return-value']  =
404404' 函数无值返回但函数使用`@return`标记了返回值' 
405405config .diagnostics [' need-check-nil' = 
406406' 变量之前被赋值为`nil`或可选值(可能为 `nil`)' 
407+ config .diagnostics [' unnecessary-assert' = 
408+ ' 启用对冗余断言(针对始终为真值的表达式)的诊断' 
407409config .diagnostics [' no-unknown' = 
408410' 变量的未知类型无法推断' 
409411config .diagnostics [' not-yieldable' = 
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ DIAG_OVER_MAX_ARGS      =
3636' 函式最多接收 {:d} 個引數,但獲得了 {:d} 個。' 
3737DIAG_MISS_ARGS           = 
3838' 函式最少接收 {:d} 個引數,但獲得了 {:d} 個。' 
39+ DIAG_UNNECESSARY_ASSERT  = 
40+ ' 不必要的斷言:此表達式始終為真值。' 
3941DIAG_OVER_MAX_VALUES     = 
4042' 只有 {} 個變數,但你設定了 {} 個值。' 
4143DIAG_AMBIGUITY_1         = 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments