Bash functions style cleanup 81/20581/3
authorVratko Polak <vrpolak@cisco.com>
Wed, 10 Jul 2019 11:59:50 +0000 (13:59 +0200)
committerPeter Mikus <pmikus@cisco.com>
Wed, 10 Jul 2019 14:23:48 +0000 (14:23 +0000)
commit36d56bdb7f9f394047e2df3f29bf47db877b649c
treede01e08334759f2f41b30dabcbd179b94015b0e0
parente45404bf7b8cbdb10adf85815c2e005134e463ad
Bash functions style cleanup

+ Update rst documentation for bash style
 + Command substitution:
  + Clarify when to use backticks.
  + Recommend avoiding nested command substitution.
  + Do not recommend putting command substitution results into quotes.
 + Function definition content:
  + Move "set -exuo pipefail" after comment only blocks.
  + Other set flags allowed for functions with good reasons.
+ Apply the new recommendations.
 - Blank lines unified in code but no written recommendation in rst.
+ Add missing references to functions called, variables read or set.
 + Add TODOs to where lists would be long.
+ Minor improvements to function descriptions.
+ Make "if" expressions more python-like.
+ Add missing "|| die" (or "|| true") where spotted.
+ Downgrade DEFAULT_NIC to a local variable.
+ Add TODO to list reasons for blacklisted tags.

Change-Id: I05dce030a8c2cb1b3a242d8b977e8fe150d8ee20
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
docs/bash_code_style.rst
resources/libraries/bash/function/ansible.sh
resources/libraries/bash/function/artifacts.sh
resources/libraries/bash/function/artifacts_hc.sh
resources/libraries/bash/function/branch.sh
resources/libraries/bash/function/common.sh
resources/libraries/bash/function/device.sh
resources/libraries/bash/function/gather.sh
resources/libraries/bash/function/per_patch.sh