FAForever / FAForever/fa

Inconsistent naming/usage of sessionInfo and scenarioInfo

Open
#4,875 0 comments 0 reactions 0 assignees View on GitHub
area: code style
Dominant language
Lua
Stars
264
Forks
260
Avg merge
3d 2h
Merged PRs (30d)
21

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.