3

I am searching a tool to find code duplication in Python code and HTML templates.

For Python I tried pylint, but it is very limited. See issue1915.

But maybe this is not a task which needs to be done again and again for every programming language. Maybe there is a tool which can do this for any kind of text....

Needed features:

  • find duplicate text in files.
  • Whitespace changes should get ignored
  • open source
  • optional: Find duplicates even if some parts where slightly changed (for example a variable was renamed)
2
  • 1
    Did you find a solution to your problem? – Martin Thoma Sep 8 '20 at 10:34
  • @MartinThoma I did not find a solution. I did not actively looked for an answer during the last months since I switched the job. – guettli Sep 10 '20 at 9:14
1

You might want to give PDM a try. It has a tool called "cpd" (copy paste dectection). You run it like this:

cpd --language python --minimum-tokens 100 --files your_code

Pylint

I also found pylint too limited. This is how I used the similarities checker:

pylint --disable=all --enable=similarities your_code
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.