[GH-ISSUE #1264] Code review required #979

Closed
opened 2026-02-27 02:54:39 +03:00 by kerem · 6 comments
Owner

Originally created by @dgibbs64 on GitHub (Jan 20, 2017).
Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/1264

A general code review to ensure that the same standards of code are being followed across the board.

For example there are several types of if statement variations being used. These should be the same across the board

if [ "${var}" == "${var}" ]
if "${var}" -eq "${var}"
if [ "${var}" -eq 0 ]

A good idea woudl be to start a wiki page with the standards expected to ensure all developers use the same code across the board

Originally created by @dgibbs64 on GitHub (Jan 20, 2017). Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/1264 A general code review to ensure that the same standards of code are being followed across the board. For example there are several types of if statement variations being used. These should be the same across the board if [ "${var}" == "${var}" ] if [[ "${var}" -eq "${var}" ]] if [ "${var}" -eq 0 ] A good idea woudl be to start a wiki page with the standards expected to ensure all developers use the same code across the board
kerem 2026-02-27 02:54:39 +03:00
Author
Owner

@UltimateByte commented on GitHub (Jan 21, 2017):

if "${var}" -eq "${var}"
if [ "${var}" -eq 0 ]

Those are arithmetic comparisons. For that reason, ${var} should be a numeric value, making the double quotes unnecessary.

So my question is: is this more about the look and preventing mistakes then? (Trying to understand the reason for this)

Edit: Or are you saying -eq -lt -le shouldn't be used at all, but rather == < <= ?

That's a good idea to add an entry for that onto the wiki.

Other rules i can think of atm:

  • Variables are lowercase regular characters only
  • Additional information messages are given in the form of echo " * Message here"
  • Any var is called with "${var}" syntax
  • Directories are always called using LGSM variables

Huh, there are probably plenty more of them, need to fill up a list. :o))

<!-- gh-comment-id:274250271 --> @UltimateByte commented on GitHub (Jan 21, 2017): if [[ "${var}" -eq "${var}" ]] if [ "${var}" -eq 0 ] Those are arithmetic comparisons. For that reason, ${var} should be a numeric value, making the double quotes unnecessary. So my question is: is this more about the look and preventing mistakes then? (Trying to understand the reason for this) Edit: Or are you saying -eq -lt -le shouldn't be used at all, but rather == < <= ? That's a good idea to add an entry for that onto the wiki. Other rules i can think of atm: - Variables are lowercase regular characters only - Additional information messages are given in the form of `echo " * Message here"` - Any var is called with `"${var}"` syntax - Directories are always called using LGSM variables Huh, there are probably plenty more of them, need to fill up a list. :o))
Author
Owner

@dgibbs64 commented on GitHub (Jan 21, 2017):

Yup this is something to build on over time. Its mainly for look and consistency to reduce errors. Something I take extra time to ensure however with there being multiple contributors I cannot always check all the code and will miss stuff somtimes.

These notes will also be useful for me to reference myself when vetting code as I myself forget which way is the standard way somtimes

<!-- gh-comment-id:274262018 --> @dgibbs64 commented on GitHub (Jan 21, 2017): Yup this is something to build on over time. Its mainly for look and consistency to reduce errors. Something I take extra time to ensure however with there being multiple contributors I cannot always check all the code and will miss stuff somtimes. These notes will also be useful for me to reference myself when vetting code as I myself forget which way is the standard way somtimes
Author
Owner

@UltimateByte commented on GitHub (Jan 23, 2017):

Made a base page to start with

https://github.com/GameServerManagers/LinuxGSM/wiki/Syntax-&-Conventions

<!-- gh-comment-id:274466936 --> @UltimateByte commented on GitHub (Jan 23, 2017): Made a base page to start with https://github.com/GameServerManagers/LinuxGSM/wiki/Syntax-&-Conventions
Author
Owner

@braunsonm commented on GitHub (Jan 26, 2017):

This can probably be closed, we have a contributing guide and have started works on a wiki page to solve this issue.
@UltimateByte @dgibbs64

<!-- gh-comment-id:275306789 --> @braunsonm commented on GitHub (Jan 26, 2017): This can probably be closed, we have a contributing guide and have started works on a wiki page to solve this issue. @UltimateByte @dgibbs64
Author
Owner

@UltimateByte commented on GitHub (Jan 26, 2017):

Yeah I think so, we can still improve the wiki over time though.
We got some nice doc for new contributors now already. I've seen some people coming, saying they want to learn bash, and saying they want to help with LGSM recently, which was kinda rare before, so it looks like it's having some effects already.

<!-- gh-comment-id:275375815 --> @UltimateByte commented on GitHub (Jan 26, 2017): Yeah I think so, we can still improve the wiki over time though. We got some nice doc for new contributors now already. I've seen some people coming, saying they want to learn bash, and saying they want to help with LGSM recently, which was kinda rare before, so it looks like it's having some effects already.
Author
Owner

@lock[bot] commented on GitHub (Jul 19, 2018):

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

<!-- gh-comment-id:406119499 --> @lock[bot] commented on GitHub (Jul 19, 2018): This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Sign in to join this conversation.
No labels
Atomic
Epic
cannot reproduce
command: backup
command: console
command: debug
command: details
command: fast-dl
command: install
command: mods
command: monitor
command: post-details
command: restart
command: send
command: start
command: stop
command: update
command: update-lgsm
command: validate
command: wipe
distro: AlmaLinux
distro: Arch Linux
distro: CentOS
distro: Debian
distro: Fedora
distro: RedHat
distro: Rocky Linux
distro: Ubuntu
distro: openSUSE
engine: goldsrc
engine: source
game: 7 Days to Die
game: ARMA 3
game: Ark: Survival Evolved
game: Assetto Corsa
game: Avorion
game: BATTALION: Legacy
game: Barotrauma
game: Battalion 1944
game: Battlefield 1942
game: Black Mesa: Deathmatch
game: Blade Symphony
game: Call of Duty 2
game: Call of Duty 4
game: Call of Duty: United Offensive
game: Counter-Strike 1.6
game: Counter-Strike 2
game: Counter-Strike: Global Offensive
game: Counter-Strike: Source
game: Day of Infamy
game: Dayz
game: Death Match Classic
game: Don't Starve Together
game: ET: Legacy
game: Eco
game: Factorio
game: Factorio
game: Garry's Mod
game: Half-Life
game: Hurtword
game: Insurgecy
game: Insurgecy
game: Insurgency: Sandstorm
game: Just Cause 3
game: Killing Floor
game: Killing Floor 2
game: Left 4 Dead 2
game: Minecraft
game: Minecraft Bedrock
game: Mordhau
game: Multi Theft Auto
game: Mumble
game: Natural Selection 2
game: No More Room in Hell
game: Pavlov VR
game: Post Scriptum
game: Project Zomboid
game: Quake 3
game: QuakeWorld
game: Red Orchestra: Ostfront 41-45
game: Return to Castle Wolfenstein
game: Rising World
game: Rust
game: San Andreas Multiplayer
game: Satisfactory
game: Soldat
game: Soldier of Fortune 2
game: Squad
game: Squad 44
game: Starbound
game: Stationeers
game: Sven Co-op
game: Team Fortress 2
game: Teamspeak 3
game: Teeworlds
game: Terraria
game: The Front
game: Unreal Tournament 2004
game: Unreal Tournament 3
game: Unreal Tournament 99
game: Unturned
game: Valheim
game: Wurm Unlimited
game: Zombie Master Reborn
game: label missing
good first issue
help wanted
info: alerts
info: dependency
info: docker
info: docs
info: email
info: query
info: steamcmd
info: systemd
info: tmux
info: website
info: website
needs more info
outcome: duplicate
outcome: issue resolved
outcome: issue resolved
outcome: issue unresolved
outcome: pr accepted
outcome: pr rejected
outcome: unconfirmed
outcome: wontfix
outcome: wrong forum
potential-duplicate
priority
pull-request
type: bug
type: feature
type: feature
type: feature request
type: game server request
type: refactor
waiting response
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/LinuxGSM#979
No description provided.