Lots of code review improvements
Release 1.18.0
Our Code Review functionality is generally available for GitHub! Install it here. It is free for open source repos, and has a 2-week trial otherwise.
We’d love to hear your feedback! Reach out at Reviews@sourcery.ai. For general inquiries, contact us at hello@sourcery.ai. Ask for help or suggest improvements on GitHub.
Full Changelog
Code Review
Features
- Expanded the list of supported languages during reviews to include most programming languages supported by GitHub.
- Added new review areas to improve the quality of your code, including:
- a complexity review that spots overly complex code and suggests improvements;
- a testing review for improving test suites;
- a security review area that spots and reports hard-coded secrets (like passwords) in your code.
- Sourcery will now include suggested changes in review comments of the
suggestion
type (where applicable) to help you improve your code. - Reviews can now be triggered by posting
@sourcery-ai review
in a pull request comment.- Posting
@sourcery-ai review
can be used both to request a first review and to re-request a review after making changes; - The contents of the comment must be exactly
@sourcery-ai review
for the review to be triggered - any additional text will cause Sourcery to ignore the comment; - The review can be triggered by open-source projects even if Sourcery is not installed on the repository.
- Posting
Bug Fixes
- Added a fix to prevent review comments from spanning too many lines, making them easier to read on GitHub.
- Fixed a bug that prevented some Sourcery in-line suggestions from being displayed in reviews.
- Fixed a bug where Sourcery would post duplicate comments in reviews.
- Fixed a bug where Sourcery would review the same pull request multiple times without being triggered.
- Fixed an issue where Sourcery would post an unreasonable number of comments on some pull requests.
- Fixed an issue where Sourcery would post praise-like comments in reviews, which are not actionable feedback.
- Fixed an issue where Sourcery would question changes that were clearly the intent of the pull request.
- Fixed internal issues that caused Sourcery to crash when reviewing certain pull requests.
- Sourcery will now skip reviewing pull requests with too many changes to prevent crashes.
Other Improvements
- Added a details section to the review summary showing the focus areas of the review and the number of issues found in each area.
- Sourcery will now skip reviewing the following types of files:
- Lock files;
- Minified files;
- Packaging files.
- Sourcery will now mention the author of the pull request in the review summary
for better feedback in reviews. The mention is in the form of
@author
. - Improved the structure of review comments to make them more readable and actionable.
- Improved the messaging when reviews are skipped.
- Sourcery will now skip reviewing pull requests created by other bots, such as automated dependency updates by Dependabot.
- Introduced many other small improvements to make reviews more accurate and actionable.
Other Improvements
- Added docs for the new code review functionality.
- Added a new troubleshooting section to help understand why Sourcery might be disabled for your account.
- (Python) Fixed a bug in
use-fstring-for-formatting
that caused Sourcery to suggest using f-strings with starred expressions. - (Python) Fixed the parsing of tuples in pattern matching.
- Improved the overall performance of Sourcery’s rules and in-line suggestions, making them faster and reducing the memory footprint.
- Updated the docs for logging in on PyCharm.