Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should flake8 cry on unused variables? #2475

Open
ReimarBauer opened this issue Aug 21, 2024 · 3 comments
Open

should flake8 cry on unused variables? #2475

ReimarBauer opened this issue Aug 21, 2024 · 3 comments
Labels
question Further information is requested tests

Comments

@ReimarBauer
Copy link
Member

ReimarBauer commented Aug 21, 2024

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 ReimarBauer added question Further information is requested tests labels Aug 21, 2024
@joernu76
Copy link
Member

joernu76 commented Aug 21, 2024

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)

@ReimarBauer
Copy link
Member Author

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.

@joernu76
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested tests
Projects
None yet
Development

No branches or pull requests

2 participants