summaryrefslogtreecommitdiff
path: root/tests/functional/c/consider_swap_variables.py
blob: e3320773f5b593b803d5f601e8d771151b2087e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# pylint: disable=missing-docstring,invalid-name,using-constant-test

a, b, c, d = 'a b c d'.split()

temp = a # [consider-swap-variables]
a = b
b = temp

temp = a  # only simple swaps are reported
a = b
if True:
    b = a

temp = a  # this is no swap
a = b
b = a

temp = a, b  # complex swaps are ignored
a, b = c, d
c, d = temp

temp = a # [consider-swap-variables]
a = b  # longer swap circles are only reported once
b = temp
temp = a