4

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
  • 2
    Did you find a solution to your problem? Sep 8, 2020 at 10:34
  • 1
    @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, 2020 at 9:14

1 Answer 1

2

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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