FAForever / FAForever/fa

Inconsistent naming/usage of sessionInfo and scenarioInfo

オープン
#4,875 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: code style
主要言語
Lua
スター
264
フォーク
260
平均マージ
3日 2時間
マージ済み PR(30日)
21

説明

### TLDR:
The `scenario` or `scenarioInfo` variable name seems to be mixed up with the `sessionInfo` variable name in a number of places.

### Problem description
The intended naming convention (as I interpret it) is to call the results of [`SessionGetScenarioInfo()`](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/engine/User.lua#L840) one of `scenario` of `scenarioInfo`.

This seems indicated by the naming of the engine function (get the ScenarioInfo from the Session, aligning with other calls prefixed by Session), as well as [disconnect.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/dialogs/disconnect.lua#L15), [depth.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/cursor/depth.lua#L93), and [hover.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/cursor/hover.lua#L59). In addition these are explicitely different variables in [SinglePlayerLaunch.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/SinglePlayerLaunch.lua#L247).

The examples I could find where this convention is not respected are [performance.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/system/performance.lua#L544), [AIUtilitiesView.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/dialogs/AIUtilitiesView.lua#L8), [diplomacy.lua 1](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/diplomacy.lua#L292)[+2](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/diplomacy.lua#L400), [gameresult.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/gameresult.lua#L10), [MapUtilities.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/MapUtilities.lua#L12), [Profiler.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/Profiler.lua#L17), [score.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/score.lua#L32), and [tabs.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/tabs.lua#L12).

Weirdly [objectiveDetail.lua](https://github.com/FAForever/fa/blob/5746ece033c3962edc292259dcb98810bd57d45c/lua/ui/game/objectiveDetail.lua#L601) also calls it something else entirely.

### Proposed solution
Rename all instances of variables being incorrectly called `sessionInfo` to `scenarioInfo` (although an argument could be made for `scenario`).

I'd be happy to make a PR for this if there's agreement for it.

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

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

評価

この issue はまだ評価されていません。

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

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