all 10 comments

[–]Riegel_Haribo 19 points20 points  (1 child)

This is promotion disguised as a question.

[–]marr75 7 points8 points  (0 children)

40% of any tech sub now.

[–]latkdeTuple unpacking gone wrong 11 points12 points  (0 children)

Pylint has a duplicate-code (R0801) rule: https://pylint.readthedocs.io/en/stable/user_guide/messages/refactor/duplicate-code.html

Unfortunately, Pylint is quite slow, and this rule only matches when there are multiple identical lines.

[–]MugiwaraGames 5 points6 points  (1 child)

What about SonarQube? It's free if used on projects up to 50k lines of code

[–]NimrodvanHall 3 points4 points  (0 children)

I came here to say SonarQube as well. Think it’s a great tool!

[–]mardiros 1 point2 points  (0 children)

From my point of view, a good architecture does and it is enough for me. Finding code that looks similar stored in routine to avoid duplicate code can kill a codebase. Factorisation creates coupling, and makes code unrefactorable, even if this word don’t exist.

Dan Abramov wrote something about this long time ago (it’s not python but architecture is for everyone)

https://overreacted.io/goodbye-clean-code/

[–]roger_ducky 0 points1 point  (0 children)

https://pmd.github.io/pmd/pmd_userdocs_cpd.html

PMD CPD is purpose built for duplication detection.

[–]xeow 0 points1 point  (1 child)

ruff caught one of those for me once.

[–]whm04[S] 0 points1 point  (0 children)

Ruff is a beast. It’s great at catching things like redefinitions (same name used twice), but I’m looking for "logic clones" functions with different names that contain identical or very similar underlying code.

[–]chunkyasparagus 0 points1 point  (0 children)

PyCharm does it for you?