本篇文章記錄一下,針對(duì)軟件開(kāi)發(fā)公司bug數(shù)量的一些思考,到底團(tuán)隊(duì)開(kāi)發(fā)中怎樣一個(gè)bug數(shù)量算是正常情況,以下是我收集到信息.
bug率標(biāo)準(zhǔn)
CMMI級(jí)別中做出了相關(guān)的指標(biāo)規(guī)定,千行代碼缺陷率(bug率):
CMM1級(jí) 11.95‰
CMM2級(jí) 5.52‰
CMM3級(jí) 2.39‰
CMM4級(jí) 0.92‰
CMM5級(jí) 0.32‰
可以通過(guò)git log統(tǒng)計(jì)代碼數(shù)量
git log的方式,依賴(lài)于提交記錄,統(tǒng)計(jì)全量,統(tǒng)計(jì)個(gè)人,按時(shí)間段統(tǒng)計(jì)都能做,但有一些問(wèn)題 :
經(jīng)測(cè)試不能完全反應(yīng)整體的記錄,只是單純的統(tǒng)計(jì)數(shù)量增加,空白行不能省略
在加上時(shí)間段統(tǒng)計(jì)后,調(diào)整時(shí)間,部分不準(zhǔn)確git log的方式,依賴(lài)于提交記錄,統(tǒng)計(jì)全量,統(tǒng)計(jì)個(gè)人,按時(shí)間段統(tǒng)計(jì)都能做,但有一些問(wèn)題 :
經(jīng)測(cè)試不能完全反應(yīng)整體的記錄,只是單純的統(tǒng)計(jì)數(shù)量增加,空白行不能省略
在加上時(shí)間段統(tǒng)計(jì)后,調(diào)整時(shí)間,部分不準(zhǔn)確
統(tǒng)計(jì)總量
git log --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'
統(tǒng)計(jì)總量:按時(shí)間節(jié)點(diǎn)
git log --pretty=tformat: --since ==2021-4-1 --until=2022-01-31 --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'
統(tǒng)計(jì)個(gè)人:按提交人
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --since ==2021-4-1 --until=2022-01-31 --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done
統(tǒng)計(jì)個(gè)人:按提交人和指定文件后綴 (.html|.cs|.md|.xml|.properties)
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | grep "\(.html\|.cs\|.md\|.xml\|.properties\)$" | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done
統(tǒng)計(jì)個(gè)人按時(shí)間
git log --since=2021-11-28 --until=2022-11-28 --author="name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }