GDQuest / GDQuest/GDScript-formatter

Linter: no-else-return failing to detect return in this case

オープン
#339 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
455
フォーク
39
平均マージ
1日 15時間
マージ済み PR(30日)
4

説明

There is a bug in your linter that causes it to not recognize that the designated block can fail the if statement and skip the return statement:
1) The incorrect warning is:
“WARNING on line 75 (no-else-return)
Unnecessary 'else' after 'if'/'elif' blocks that end with 'return'”

2) The code that triggered this error is:
...
#Return false if vector_angle falls between start_arc and end_arc.
#This will ensure that weapons can only fire within their designated arcs.
if end_arc > start_arc:
if vector_angle > end_arc or vector_angle < start_arc:
return false
else:
if vector_angle > end_arc and vector_angle < start_arc:
return false

#Ensure target is within range
if vector_to_target.length() > ability_range:
return false
else:
return true

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

no-else-return ルールの linter 実装から始め、提供された入れ子の if/else スニペットで警告を再現します。前の分岐が続行可能な場合に、ルールが最後の else を不要として報告しなくなり、このケースの回帰テストがカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
godot, rust
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。