From 7f962288734b5e410b5579dc19efb07a18ad9ff5 Mon Sep 17 00:00:00 2001 From: Dirk Wetter Date: Sun, 19 Mar 2017 09:48:47 +0100 Subject: [PATCH] Updated Coding Style (markdown) --- Coding-Style.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Coding-Style.md b/Coding-Style.md index 4412d83..a39e196 100644 --- a/Coding-Style.md +++ b/Coding-Style.md @@ -20,7 +20,7 @@ * 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 ( use $(..) instead ) +* don't use backticks anymore, use ``$(..)`` instead * use double square instead of single square brackets * mind: http://mywiki.wooledge.org/BashPitfalls @@ -28,23 +28,23 @@ * 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. + * don't use highly system depended binaries (rpm, ipconfig, ..) as it is not portable or requires lot's of efforts to be portable and the code gets ugly. * 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. +* If a feature of openssl is not available you need to tell this by using pr_warning*() -- 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 -* avoid a mix of e.g. (sed and awk) or (cut and sed) or (sed, tr and \). +* avoid a mix of several external binaries e.g. (sed and grep and tr) if you can achieve the same with e.g. awk. * 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 -* use the short functions / methods +* make use the short functions / methods (code starts from ``###### helper function definitions``) like * count_words() / count_lines() / count_ciphers() * strip_lf() / strip_spaces() * toupper() * newline_to_spaces() * is_number() / is_ipv4addr() / is_ipv6addr() - + * ...