Leader: base health metrics
This course looks at code health metrics through one Ruby application's own numbers. It starts with 82.99% line coverage and reads the SimpleCov resultset to find the 126 uncovered application lines behind it. It compares the question each metric answers, from line, branch and mutation coverage to complexity, churn and suite runtime. It builds a health report from commands already installed, crosses churn with file size, and shows how a metric set as a target stops measuring. It ends with a five-row report reviewed once a cycle.
What you'll learn
- ✓Reading coverage/.resultset.json to turn a percentage into a list of uncovered lines
- ✓The question each health metric answers and what it cannot tell you
- ✓Building a health report from rspec, rubocop, brakeman, find and git log
- ✓Crossing churn with file size to find files that are risky to change
- ✓How metrics set as targets get gamed, and what to track instead
- ✓A five-row report and the one conversation it prompts each cycle
The number and the lines behind it
This application reports 82.99% line coverage. That number is almost useless and the thing behind it is not, and the gap between the two is what this course is about.
Read the full lesson free →Curriculum
7 lessonsThe number and the lines behind it
Reads SimpleCov's per-line data behind 82.99% coverage and finds 126 uncovered application lines, including untested failure paths.
What each metric answers
Maps ten health metrics to the one question each answers, and separates leading from lagging indicators.
What this repository can measure today
Builds a nine-row health report from installed commands and lists what it leaves out, such as cycle time.
Churn and complexity
Crosses churn with file size into four quadrants and shows coverage ranking the same file in the opposite order.
When a metric becomes a target
Applies Goodhart's law to each metric and explains why trends and lists resist gaming better than thresholds.
The report worth having
Proposes a five-row report reviewed once a cycle, explains what it leaves out, and when to change it.
Putting it together: five minutes
Combines five commands into one page with one action and one question, judged by whether it catches problems.