1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-24 18:28:47 +00:00
community.general/lib
Toshio Kuratomi 5f22b4f8ad Reduce chance of mistakes with unsafe_shell check during refactor
Code like this:

if cond1 and cond2:
    pass
elif cond1:
    pass

Has a hidden dependency on the order that the conditions are checked.
This makes them fragile and subject to breakage during refactors.
Rewrite the code like this:

if cond1:
    if cond2:
        pass
    else:
        pass

The nested structure makes the ordering explicit and less likely for
someone to break the code when they refactor.
2017-09-28 16:48:22 -07:00
..
ansible Reduce chance of mistakes with unsafe_shell check during refactor 2017-09-28 16:48:22 -07:00