Managing the code quality of your project. Leave the past behind: Focus on new code.
- Wicklow Hall 1
- Start (Dublin time):
- Start (your time):
- 30 minutes
If you try to use Pylint or Flake8 on a legacy project, the results are usually truly overwhelming. There might be thousands of warnings, hundreds of errors and maybe even no unit tests. The usual emotional response to this is distress, exasperation... even despair. And then the question comes: Where do I start?
During this talk we will see why it’s better to set old code aside and focus first on the new code you’re writing. We’ll show some possible approaches and tools that can help you keep the focus and deliver new code with a high level of quality.
As developers we often have to deal with legacy projects and, at the same time, we want to keep the quality and security of our deliverables under control.
As soon as we start running some linter (like Pylint or Flake8) on such a legacy project, there is a huge number of violations. To handle those issues, we might want to start by only looking at the changed files in a pull request instead of the entire project, for example by using git diff
pylint `git diff --name-only --diff-filter=d`
During this talk I’d like to push this concept a bit further and outline an approach and philosophy that can be helpful in dealing with code quality : Clean as you code.
What is Clean as you code?
- Not only about violations: It can be extended to code coverage and all code metrics in general.
- The quality you want to measure should be based only on recent changes.
Why Clean as you code matters?
- It helps your team stay focused on delivering new features
- It helps you deal with technical debt incrementally: Sometimes you might need to modify old code, and, at that point, you might be able to fix existing violations
How to apply Clean as you code?
- Shaping a quality gate in order to define code quality standards for the software delivered by your team today
- Using appropriate tools (like SonarQube)