The purpose of branch coverage is to check whether every conditional branch in a given line of code has been tested and Ruby has this feature since
simplecov can report branch coverage too and now so does
undercover with the new
This addition allows you to detect even more untested code within each automated pull request review, including untested case statements, conditional method calls (e.g.
foo&.jump), single-line ifs (
return :foo if valid?) or ternaries (
foo ? 1 : 2).
Head over to the readme if you’re getting started, otherwise here’s what to do to add branch…
Today, I’m launching UndercoverCI— a CI robot who protects your Ruby codebase from untested code changes. Take a moment to learn why you should add it to your team’s code review workflow.
Adding UndercoverCI to your code review workflow will prevent untested code changes from slipping into production without anyone noticing.
UndercoverCI is a GitHub App for Ruby that finds untested code changes in your commits and pull requests by reading each diff and comparing against a test coverage report. The result: actionable comments on untested methods, classes and blocks, whereas other coverage tools would only give you percentage data.
This is part 2 of Stop Shipping Untested Ruby Code with Undercover. If you’re wondering What The Heck™️ all of this is about, you may want to read the first post in a new tab.
Ruby’s SimpleCov lets us track test coverage and is common when developing Ruby on Rails apps. Many code review services that rely on SimpleCov allow us to see the coverage delta or diff coverage as a percentage. …
Ruby is a productive and fun to work with environment with lots of useful tools and products for managing software quality. Today, I am excited to share one of my recent ideas in that space: Undercover, a gem that stops us developers from shipping untested code in CI and in dev: https://github.com/grodowski/undercover.
Undercover inspects changed files and creates warnings for blocks of code which have not been tested, similar to a linter. It’s a simple idea I found useful in a large codebase along with existing coverage reporting tools and I hope you’ll see the value as well!
Providing a complete, automated code review toolkit that the web and mobile developers could trust and love, is our primary goal at codebeat.
software engineer @rainforestqa, hardware hacker and fixed-gear cycling enthusiast from Warsaw, PL.