Part I: Identify Code That’s Hard to Understand
Chapter 3: Discover Hotspots: Create an Offender Profile of Code
Restrict the Hotspot Analysis to Parts of a Codebase
To restrict the analysis to the react-dom package, you tweak the arguments to Git and cloc. For Git, you do this by specifying a path. Move into your react repository and run the following:
| prompt> git log --all --numstat --date=short \ |
| --pretty=format:'--%h--%ad--%aN' --no-renames \ |
| --after=2021-08-01 \ |
| -- packages/react-dom > react_dom_log.txt |
The path separator, --, ensures that only the commits relating to react-dom get included.
For cloc, it’s even simpler: specify the directory of interest, packages/react-dom/ ...
Get Your Code as a Crime Scene, Second Edition, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.