Hacker Newsnew | past | comments | ask | show | jobs | submit | brendanator's commentslogin

Totally agree - we’re working on this at https://sourcery.ai


Haha fair counter - but I think the typical current ways of reviews is more unnecessarily inefficient and the downside risk of something going wrong in a PR being merged is way lower than in the FDA/housing inspection case.

There are types of code changes that definitely need reviews - but those are the small minority of all code changes and the way we approach those changes should be different from how we handle all other changes


Hi HN! We're Brendan, Nick and Tim — founders of Sourcery.

We're building the most advanced refactoring tool in the world. Most refactoring tools require the user to decide what refactorings to make. Sourcery turns that around and proposes refactorings to you according to its own code quality metrics. It can also do far more advanced refactorings than anything else out there.

The way it works is inspired by how an expert refactors code. They make lots of small changes, each of which slightly improves the quality of the code while keeping the functionality the same. Sourcery has a large library of small, correct refactorings that it composes together to produce larger ones. It uses code quality metrics to guide its search through the possible combinations of these refactorings to find the best overall change. We use a mix of standard metrics, like code size and cognitive complexity, along with some of our own custom metrics which capture what we think is important to high quality code.

Sourcery is currently available for Python and can be used in:

- PyCharm, VSCode and Vim where it refactors the current file you have open

- GitHub where it acts as a code review tool on PRs, suggesting refactorings and scoring the code changes with our code quality metrics

- A CLI which allows it be used as a pre-commit hook or in a CI pipeline

The next step for to start proposing refactorings at the class level, such as extracting methods to remove duplicated code. Then we will add machine learning based refactorings to capture more niche improvements that can be made when using libraries outside the standard library.

Give us a try!

You can also get an instant demo by starring this repo https://github.com/sourcery-ai/sourcery and our GitHub bot will refactor your most starred Python GitHub repo.

We would love to hear your thoughts, feedback and suggestions on how can we improve!


Thank you for all these suggestions, I've updated the article.

Your website is an excellent source of knowledge!


Multi stage builds do indeed seem much better, thanks

Regarding writing bytecode - this slows down the first load of a file, in exchange for speeding up subsequent loads of a file. It has no effect on runtime speed. Given that python code is only loaded once when a Docker image is run, it is better to disable this.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: