Page MenuHomeWildfire Games

Syntax cleanup of GUI-interface and test.
ClosedPublic

Authored by Freagarach on Jul 13 2019, 3:14 PM.

Details

Reviewers
Nescio
Silier
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23584: Syntax cleanup of GuiInterface and test.
Summary

Makes Jenkins/Vulcan a big tad happier about the GUI and its test.

Test Plan

Verify that everything is correct and nothing overlooked.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 8345
Build 13629: Vulcan BuildJenkins
Build 13628: arc lint + arc unit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Freagarach updated this revision to Diff 8864.Jul 13 2019, 9:47 PM

Reuploading because the test doesn't fail locally.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/55/display/redirect

Nescio added a subscriber: bb.Jul 13 2019, 10:42 PM

@Nescio, you are my superior in this

Am I?
Because it involves javascript, you actually need someone else; perhaps @bb is willing to.

binaries/data/mods/public/simulation/components/GuiInterface.js
8–10

-ized
Usually I don't mind whether people use American or British spelling in comments, but using both in the same sentence is ugly.

65

which

284

let?

419–420

Shouldn't it be 2 * Math.PI?

528

idem

799–800

Aren't comments typically on a new line? (Also below.)

1135

hold

1144

idem

In D2069#86271, @Nescio wrote:

@Nescio, you are my superior in this

Am I?
Because it involves javascript, you actually need someone else; perhaps @bb is willing to.

I did not really change any code (except one var -> let) and, as far as I can tell, you are a very exact person. So yeah, I think you are ;)

binaries/data/mods/public/simulation/components/GuiInterface.js
1135

What they meant here was probably something like: "If yes, this holds (...)". I'm not even sure these comments (and below) are needed, because it seems obvious from the code, but that's not up to me ;)

Freagarach updated this revision to Diff 8878.Jul 14 2019, 7:34 AM
Freagarach marked 8 inline comments as done.

Thanks @Nescio!

  • Inlines.
  • One var => let.

and always discourage non-core members from doing wholesale commits like this for obvious reasons..

Sorry, didn't know,,,

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/67/display/redirect

Freagarach planned changes to this revision.Jul 18 2019, 5:28 PM

Wait for result of D2070 discussion. Especially regarding curly braces.

binaries/data/mods/public/simulation/components/GuiInterface.js
1139

I still managed to forget this.

Freagarach updated this revision to Diff 9078.Jul 23 2019, 11:48 AM
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)

Rebased after D2070.

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/202/display/redirect

Polakrity added inline comments.
binaries/data/mods/public/simulation/components/GuiInterface.js
1215

This calculation seems to get the radius so 0.5 is not really a magic value, no?
It would be the same by dividing by 2.

elexis added a subscriber: elexis.Dec 16 2019, 6:27 PM
elexis added inline comments.
binaries/data/mods/public/simulation/components/GuiInterface.js
8–10

Transltable strings are in en-US, code had been changed from british english to US english too, for example in the colour -> color commits. And Amour had always been planned to be renamed to Armor.

956

(Objects storing positions should be use the Vector prototype, so that one can use these algebraic operations. If it's globally consistent then these operations are available by default and new code would also be introduced with that feature.)

1485

(A bit noisy)

elexis retitled this revision from Cleanup of GUI-interface and test. to Syntax cleanup of GUI-interface and test..Dec 16 2019, 6:28 PM

Havent look into whole file yet.

binaries/data/mods/public/simulation/components/GuiInterface.js
954

Why brackets for one line ?
see similar solution at L1427

1007

I think this one can be nuked
same for L1019 L1023

1169

This should be obvious from next lines

1407

This looks not needed same L1427

1626

this should end with ,

Silier requested changes to this revision.Dec 19 2019, 7:58 AM
Silier added inline comments.
binaries/data/mods/public/simulation/components/GuiInterface.js
136

i think we do not really need this type of comments
One can read what we are doing by reading the code

336

please make this kind of object style consistent and put , after last key-value,
it also helps adding new key-values without need to modify previous line

565

Doxygen

577

Doxygen

603

Doxygen

614

Doxygen

620

Doxygen

1296

could you change to previewEntites.length &&

1373

you moved this, bring it back, you have changed logic

1782

You need to decide if you put those type of comments above else, under else or at the line of next instruction

This revision now requires changes to proceed.Dec 19 2019, 7:58 AM
Silier added inline comments.Dec 27 2019, 9:01 PM
binaries/data/mods/public/simulation/components/GuiInterface.js
336

make it consistent on function level, if count of both occurrences is even, make it consistent on file level :)

Freagarach updated this revision to Diff 11634.Apr 5 2020, 5:34 PM
Freagarach marked 20 inline comments as done.
  • Rebase.
  • Inlines.
binaries/data/mods/public/simulation/components/GuiInterface.js
1215

Yes, but according to the former comment it was determined through trail and error, so that would imply it is not really purposfully dividing by 2.

1363

[undefined].length == 1 I wonder whether that was intended. (From rP11760.)

Stan added a subscriber: Stan.Apr 5 2020, 5:47 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/GuiInterface.js
421

2 * Pi ? (spaces)

422

Could merge the two statements, and ternary for cmpUnit ai like so:

ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, cmpUnitAI ? 0 : 2 * Math.PI);

One might also wonder why not checking for buildingAI.

956

Is it still worth creating new objects? I still like having vectors though.

Wonder if we couldn't just pass pos to cpp

1215

Three patches modifying that line (this one, sockets, restoring turrets)

Vulcan added a comment.Apr 5 2020, 5:50 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1971/display/redirect

Freagarach updated this revision to Diff 11635.EditedApr 5 2020, 6:25 PM
Freagarach marked 4 inline comments as done.

@Stan's inlines.

binaries/data/mods/public/simulation/components/GuiInterface.js
956

"// Note that Add-/SetPosition take a CFixedVector2D which has X/Y components, not X/Z."

Vulcan added a comment.Apr 5 2020, 6:32 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1972/display/redirect

nani added a subscriber: nani.Apr 5 2020, 7:17 PM
nani added inline comments.
binaries/data/mods/public/simulation/components/GuiInterface.js
68–75

Better keep the brackets for this type of expression, otherwise diff seems OK.

Silier requested changes to this revision.Apr 11 2020, 4:19 PM

after this i can accept

binaries/data/mods/public/simulation/components/GuiInterface.js
68–75

yes, better to keep them here for readability and not exactly one line code

This revision now requires changes to proceed.Apr 11 2020, 4:19 PM
Freagarach updated this revision to Diff 11660.EditedApr 11 2020, 5:00 PM
Freagarach marked 2 inline comments as done.
  • Re-add curly braces around extended function.
  • Remove three unnecessary newlines.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/571/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1991/display/redirect

Silier accepted this revision.Apr 12 2020, 11:19 AM

linter is very happy
changes are mostly cosmetic, they do not affect how code is executed
one branch removal what is nice
changes apply to cc

This revision is now accepted and ready to land.Apr 12 2020, 11:19 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the commit @Angen, we can actually obtain useful information from the linter when modifying any of these two files now :)