mirror of
https://github.com/drwetter/testssl.sh.git
synced 2024-11-21 18:41:35 +01:00
Updated Coding Style (markdown)
parent
e19b0cc0c6
commit
46d100234e
@ -2,11 +2,14 @@
|
||||
|
||||
### This is a short brain dump which is far from being complete
|
||||
|
||||
* PR *
|
||||
* you make the life of the maintainer easier if it's only **one** patch w/ **one** functional change per PR
|
||||
|
||||
* Global variables
|
||||
* in CAPS
|
||||
* use them only when necessary
|
||||
* in CAPS
|
||||
* initialize them
|
||||
* use readonly and variable types
|
||||
* use ``readonly`` and variable types
|
||||
* if it's going to be a cmd line switch, there has to be also a global ENV variable which can be used without the switch (see e.g. SNEAKY or SSL_NATIVE)
|
||||
|
||||
* local variables (all_lower_case)
|
||||
@ -18,23 +21,18 @@
|
||||
* test before PR! If it's a check you need two bad and two good examples which should work as expected (compare results e.g. with SSLlabs)
|
||||
|
||||
* don't use backticks anymore
|
||||
|
||||
* use double square instead of single square brackets
|
||||
|
||||
* use [shellcheck](https://github.com/koalaman/shellcheck) if possible
|
||||
|
||||
* especially with sed you need to be careful as GNU sed is only 80% compatible with BSD sed (`sed -i`,` \n`, `\t`, etc.).
|
||||
|
||||
* be careful with very advanced bash features. Mac OS X is still somewhat behind with bash -- it uses bash version 3
|
||||
([http://tldp.org/LDP/abs/html/bashver4.html](differences))
|
||||
|
||||
* don't use additional binaries
|
||||
* if you really, really need to use an additional one make sure it's available on the system before calling it
|
||||
* don't use highly system depended binaries (rpm, ipconfig, ..) as it is not portable or requires lot's of efforts and ugly code to be portable.
|
||||
|
||||
* every operation (string, etc.) which works with bash internall functions: use them whenever possible (replacing tr/sed/awk)
|
||||
|
||||
* every operation (string, etc.) which works with bash internal functions: use them whenever possible (replacing tr/sed/awk), see e.g. http://www.cyberciti.biz/tips/bash-shell-parameter-substitution-2.html
|
||||
* avoid a mix of e.g. (sed and awk) or (cut and sed) or (sed, tr and \<whatsoever\>).
|
||||
* be careful with very advanced bash features. Mac OS X is still using bash version 3 ([http://tldp.org/LDP/abs/html/bashver4.html](differences))
|
||||
* especially with ``sed`` you need to be careful as GNU sed is only 80% compatible with BSD sed (`sed -i`,` \n`, `\t`, etc.).
|
||||
|
||||
* always use a return value for a function/method
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user