From: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> Date: Sun, 26 Sep 2021 13:06:35 +0000 (+0200) Subject: Squash two identical `if` branches X-Git-Tag: v9.00~62^2~11 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ad22d92f424671f410e93a6fddf4fbf299c50e87;p=users%2Fdwmw2%2Fopenconnect.git Squash two identical `if` branches This fixes a DeepSource alert: Branches of the `if` statement have similar implementation For the highlighted `if` statements, all the `elif`/`else` branches have the same body as `if`. It is recommended to refactor this snippet. If the if-chain is performing the same action in every case, it shouldn't be used there at all. Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> --- diff --git a/trojans/tncc-emulate.py b/trojans/tncc-emulate.py index 7a876a42..227be35e 100755 --- a/trojans/tncc-emulate.py +++ b/trojans/tncc-emulate.py @@ -499,10 +499,8 @@ class tncc: msg += '\npolicy:%s\nstatus:' % policy if 'Unsupported' in policy or 'Deny' in policy: msg += 'NOTOK\nerror:Unknown error' - elif 'Required' in policy: - msg += 'OK\n' else: - # Default action + # Default action, including 'Required' msg += 'OK\n' return encode_0ce7(msg.encode(), MSG_POLICY)