MSS icon indicating copy to clipboard operation
MSS copied to clipboard

should flake8 cry on unused variables?

Open ReimarBauer opened this issue 1 year ago • 4 comments

Just seen https://github.com/Open-MSS/MSS/blob/stable/mslib/msui/mscolab.py#L1965C57-L1966C1

name, file_ext = fs.path.splitext(file_name)

is defined but not used.

I am not sure about if our test in the past had seen that.

So: yes

ReimarBauer avatar Aug 21 '24 10:08 ReimarBauer

This warning is one of the actually useful ones as it hints early at typos. In this case one should assign the unused return value to a "_" variable to indicate the intent to not use it to the reader and the tool, e.g.

name, _ = fs.path.splitext(file_name)

joernu76 avatar Aug 21 '24 11:08 joernu76

also name is not used. A leftover commented is # _function = self.ui.import_plugins[file_ext[1:]] In that xml PR I removed it too, the IDE showed it.

ReimarBauer avatar Aug 21 '24 12:08 ReimarBauer

So the whole line is superfluous as it doesn't do anything? Seems like something that should be flagged?

joernu76 avatar Aug 21 '24 12:08 joernu76

I think Flake8 does not flag unused variables in tuple unpacking,this test might have been unnoticed.

anj20 avatar Feb 09 '25 07:02 anj20