Code Styles
February 24, 2023 ยท View on GitHub
First of all
- Your IDE must support editorconfig and recognize the
.editorconfigfile in project. - All code and text must be written in English.
File naming
All file names must match the regex [a-z0-9-_], except Dockerfile and other particular files.
Shell script code styles
[[ ... ]]is preferred over[ ... ],testand/usr/bin/[.- Function declaration
func() {...}is preferred overfunction func() {...}. - Read-only Variables. Use
readonlyordeclare -rto ensure they're read only. - Local Variables. Declare function-specific variables with
local. Declaration and assignment should be on different lines. - Use
$(command)instead of backticks. evalshould be avoided in most scenarios.- Constants and environment variable names must be all caps, separated with underscores.