← Back to all posts

March 19, 2021

Duplicate code detection in PyCharm

Our new duplicate code detection feature is now available for PyCharm!

You can now select multiple files or folders and choose 'Sourcery - Detect Clones' to scan for duplicated code within them. This will find sections of code that are 3 lines long or greater that are duplicated in multiple places. It will also find near-duplicate code where variable names have been changed but the code structure remains the same. The duplicate code found will appear in the Sourcery tool window.

This feature is available in our Pro subscription. It is in active development so we would love your feedback.

Duplicate code detection
Scan for duplicate code in PyCharm

Disabling code quality warnings

Have a piece of code that you don't want to touch that is giving a low quality warning?

You can now disable these warnings in VS Code and PyCharm. Add # sourcery no-metrics at the end of the line with the function definition to do so. There's also a new quick-fix action on the warnings to disable them.

Minor fixes

  • Fixed issue where Sourcery scan commands were incorrectly showing in VS Code command palette
  • Running a scan for refactorings in VS Code now shows a link to the problems pane in the notification that the scan is complete.