5 Ways Sourcery Can Help You Improve Your Code

Feb 20, 2023
hackajob Staff

Want to ensure clean code all the time? We bet you do! At hackajob, we know the power of tools created by developers for developers – and Sourcery has struck gold with what they do. Sourcery reviews your code everywhere you work and automatically suggests improvements.

They aim to enhance code quality and reduce technical debt, making your life easier and your time more efficient. Too good to be true? Not at all. We sat down with Tim Gilboy, COO and one of three founders of Sourcery to find out the five top ways they can help you improve your code. Get into it below!

Meet Tim, Brendan and Nick!

Along with his two other co-founders, Brendan and Nick, Tim has seen Sourcery and its community continue to grow. Brendan and Nick, both Software Engineers, started their careers at a retail financial software firm that had its code base written in the late 80s. By the time they had joined the firm, the codebase was complex and had plenty of parts no one understood. Brendan and Nick became skilled at refactoring and improving old code, and so Sourcery was born.

The whole team wanted to find a way to automatically help developers, and whilst they started with Python, they continue to expand into more languages. If you’re thinking that this is only for those working with established, older companies, in reality, their solution helps those from all walks of life, including early-stage startups and scale-ups as they often run into the same issues. Here are just a few ways you could benefit from Sourcery.

1. Created by developers, Sourcery is free for developers

We’re all about community. The Software Developer community – and especially the Python community – has been instrumental in shaping the success of Sourcery. Many developers have helped to improve the solution, whether by using it, testing it, or giving feedback.

As their goal is to help developers in their day-to-day, there’s a free version available for anybody to try. Think of Sourcery as your pair programmer; whether it’s a better way to rewrite code or an approach you’ve forgotten about or are not familiar with, you’ll be able to improve daily with this set of tools.

2. Get quick feedback on the code you’re writing as a developer

So for me, there are two sides to using our product. You can use it as an individual developer or as a full team, and there are benefits for both.

As an individual developer, you’ll receive quick feedback on the code you’re writing and help in writing it in a better way, It helps you to unlock and uncover opportunities to continuously improve your code. And we get it, life happens, sometimes you’re in the moment and not thinking about it, or you’re not aware of these best practices or you’re trying to rush something out – Sourcery helps you clean it up.

"One of the big advantages of using our product is that it not only tells you where there’s an issue in your code, but actually suggests a fix, while  more traditional linting tools just point out the errors with no fix. One of our core goals is that we're always giving you suggestions on how to actually improve the code.

3. Improve your team’s technical debt and codebase

When using it in a team setting, there’s the added benefit of cleaning up the whole codebase and maintaining it in a healthier way which will help all future development too. We’ve researched the impact of technical debt and bad-quality code and have seen the effect it has on team productivity. The average team with a high level of technical debt spends 2.5-3x the amount of time dealing with bug fixes and general code maintenance versus teams who can keep that at a lower level.

Having Sourcery continually review and improve your code helps you reduce the risk of hitting that level where you spend more and more time dealing with bugs and less time dealing with new feature development. You can get on with meeting the goals you’re working on as a team.

Plus from a code review perspective, you won’t have to worry about giving the same piece of feedback, as you’re able to do it automatically. So you can focus more on ‘is this code doing what it needs to do?’ during the review process and less on worrying if it follows internal standards, as it will pick this up.

4. Learn something new whether you’re a newbie or experienced

One of my biggest highlights whilst talking to developers that use Sourcery day in and day out is the excitement in the way they discuss the product and how valuable it has been to them from a development perspective. Whether it’s a new developer to Python or senior developers who've been working in Python for 20 years, there’s something to take away from everyone. If you think the tool can’t help you, we say – just try it out. We’ve had super senior developers let us know that this tool helps them to continue to grow and learn new best practices.

5. They’re continually improving their code, and will help you too

The core of Sourcery has been written in Python, and one of the reasons for this is so we could use it ourselves. We built this originally off of the Python abstract syntax tree parser, but we’ve since moved to use a tool called Tree Sitter, to do a lot more of the AST parsing. We’ve also built our own analysis engine.

On top of that, again, it’s pretty much all written in Python. There are also actual IDE integrations where you can use Sourcery in your editor and these are written in a blend of Java, JavaScript and Python. As we think about the future, we may move away from some of the tech stack being built in Python which is exciting. There’s a possibility for something like Rust as we continue to think of more complex analysis and need to see some serious performance benefits there.

And that’s it!

There’s so much more that you’ll love about Sourcery so keep up to date with them here, here and here.

Like what you've read or want more like this? Let us know! Email us here or DM us: Twitter, LinkedIn, or Facebook, we'd love to hear from you.