Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

tidy: codify unnecessary else policy #1874

Open
reidpr opened this issue Mar 22, 2024 · 0 comments
Open

tidy: codify unnecessary else policy #1874

reidpr opened this issue Mar 22, 2024 · 0 comments

Comments

@reidpr
Copy link
Collaborator

reidpr commented Mar 22, 2024

Split from #1860. Pylint:

  • R1705 no-else-return
  • R1723 no-else-break

if ((fm.st.st_dev, fm.st.st_ino) in hardlinks):
ch.DEBUG("hard link: deleting subsequent: %d %d %s"
% (fm.st.st_dev, fm.st.st_ino, path))
fm.hardlink_to = hardlinks[(fm.st.st_dev, fm.st.st_ino)]
fm.path_abs.unlink()
return fm
else:
ch.DEBUG("hard link: recording first: %d %d %s"
% (fm.st.st_dev, fm.st.st_ino, path))
hardlinks[(fm.st.st_dev, fm.st.st_ino)] = path

The else is indeed redundant, though I recall putting it there on purpose, probably thinking it was clearer. But we should probably be consistent, and it seems prohibitively difficult to positively enforce using else in these cases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant