原理

当开发提交代码行数小于特定阈值(比如阈值为 5 行),表明代码中因开发粗心、无单元测试用例导致的简单 bug。

命令

git log --pretty=format:"%h %cd %an %s" --date=format:"%Y-%m-%d %H:%M" --shortstat

示例

  1. 示例项目:Jacoco

  2. git log 记录

$ git log --pretty=format:"%h %cd %an %s" --date=format:"%Y-%m-%d %H:%M" --shortstat master
215a9414 2018-08-20 23:36 Evgeny Mandrikov Get rid of unnecessary instances of Matcher in KotlinLateinitFilter (#750)
 1 file changed, 14 insertions(+), 18 deletions(-)

1e01244a 2018-08-20 22:07 Evgeny Mandrikov KotlinWhenFilter should be stateless (#749)
 2 files changed, 3 insertions(+), 3 deletions(-)

1cd039a5 2018-08-20 21:18 Evgeny Mandrikov All merged instructions should have same covered branches (#747)
 1 file changed, 11 insertions(+), 1 deletion(-)

964778bb 2018-08-20 19:53 Evgeny Mandrikov StringSwitchEcjFilter and KotlinWhenStringFilter should use correct VarInsnNode (#746)
 5 files changed, 28 insertions(+), 7 deletions(-)

6bbb012d 2018-08-20 12:17 Evgeny Mandrikov Add support for Java 11 and 12 class files with "preview features" (#743)
 3 files changed, 23 insertions(+), 4 deletions(-)

0484d9dd 2018-08-19 02:28 Evgeny Mandrikov Use FilterTestBase in KotlinWhenStringFilterTest
 1 file changed, 4 insertions(+), 38 deletions(-)

3288f34c 2018-08-18 23:15 Evgeny Mandrikov Do not use `~/.m2/settings.xml` provided by Travis (#742)
 1 file changed, 10 insertions(+), 5 deletions(-)

215f7668 2018-08-18 20:07 Evgeny Mandrikov Add filter for Kotlin when-expressions that list all cases of enum (#729)
 7 files changed, 111 insertions(+), 13 deletions(-)

32073eaf 2018-08-18 08:01 Evgeny Mandrikov Add filter for Kotlin when-expressions with String (#737)
 5 files changed, 257 insertions(+), 3 deletions(-)

e629bf0f 2018-08-18 06:18 Evgeny Mandrikov Filter switch on String for which ECJ omits last goto (#741)
 5 files changed, 82 insertions(+), 44 deletions(-)

68ab19f3 2018-08-17 22:14 Evgeny Mandrikov Remove unused imports
 2 files changed, 3 deletions(-)

4741fb65 2018-08-17 21:37 Evgeny Mandrikov Add filter for bytecode that ECJ generates for String in switch (#735)
 11 files changed, 350 insertions(+), 37 deletions(-)

3208aad8 2018-08-17 16:38 Evgeny Mandrikov Fix typo
 1 file changed, 1 insertion(+), 1 deletion(-)

14652600 2018-08-17 16:09 Evgeny Mandrikov Remove useless jacoco.fileSets from documentation of MergeMojo (#739)
 1 file changed, 1 insertion(+), 1 deletion(-)

63d55acf 2018-08-17 02:56 Lukas Krejci Maven goal `report-aggregate` should consider dependencies specified using version range (#658)
 8 files changed, 101 insertions(+), 4 deletions(-)

436f0227 2018-08-16 11:44 Evgeny Mandrikov Add experimental support for Java 12 class files (#738)
 7 files changed, 19 insertions(+), 2 deletions(-)
  1. 问题 1 #3208aad8 单词拼写错误

  2. 问题 2 #14652600

特别说明

本文仅使用 jacoco 项目作为示例,jacoco 的代码质量是非常高的,我举例可能不太恰当。但是在项目测试过程中可以根据开发修改 bug 变更代码行数确定问题是否由于开发粗心、单元测试未覆盖导致的问题。


↙↙↙阅读原文可查看相关链接,并与作者交流