Updated Coding Style (markdown)

Dirk Wetter 2015-12-29 20:33:54 +01:00
parent 46d100234e
commit 666515f28a

@ -18,10 +18,11 @@
* use "speaking variables" but don't overdo it with the length * use "speaking variables" but don't overdo it with the length
* 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) * test before doing a PR! If it's a check best you check with two bad and two good examples which should work as expected (compare results e.g. with SSLlabs)
* don't use backticks anymore * don't use backticks anymore
* use double square instead of single square brackets * use double square instead of single square brackets
* mind: http://mywiki.wooledge.org/BashPitfalls
* use [shellcheck](https://github.com/koalaman/shellcheck) if possible * use [shellcheck](https://github.com/koalaman/shellcheck) if possible
@ -29,6 +30,10 @@
* if you really, really need to use an additional one make sure it's available on the system before calling it * 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. * 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.
* If it's an openssl feature you want to use and it could be not available for older openssl versions testssl.sh needs to find out whether openssl has that feature. Best do this with openssl itself and not by checking the version as some vendors do backports. See the examples for HAS_SSL2 or proxy option check of openssl in check_proxy().
* If a feature of openssl is not available you need to tell this by using pr_litemagenta*() / pr_minor_prob*() or accordingly with fatal() -- if a continuation of the program doesn't make sense anymore.
* 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 * 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\>). * 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)) * 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))