Updated SLOC count doc. Added McCabe complexity to Makefile.

This commit is contained in:
Steve Karg
2023-12-11 10:01:35 -06:00
parent cc84a16c14
commit 7bcaa61f36
3 changed files with 56 additions and 18 deletions
+34
View File
@@ -322,6 +322,40 @@ SPELL_OPTIONS = --enable-colors --ignore-words-list $(IGNORE_WORDS)
spell:
codespell $(SPELL_OPTIONS) ./src
# McCabe's Cyclomatic Complexity Scores
# sudo apt install pmccable
COMPLEXITY_SRC = \
$(wildcard ./src/bacnet/*.c) \
$(wildcard ./src/bacnet/basic/*.c) \
$(wildcard ./src/bacnet/basic/binding/*.c) \
$(wildcard ./src/bacnet/basic/service/*.c) \
$(wildcard ./src/bacnet/basic/sys/*.c) \
./src/bacnet/basic/npdu/h_npdu.c \
./src/bacnet/basic/npdu/s_router.c \
./src/bacnet/basic/tsm/tsm.c
.PHONY: pmccabe
pmccabe:
pmccabe $(COMPLEXITY_SRC) | awk '{print $$2,$$6,$$7}' | sort -nr | head -20
# sudo apt install complexity
# 0-9 Easily maintained code.
# 10-19 Maintained with little trouble.
# 20-29 Maintained with some effort.
# 30-39 Difficult to maintain code.
# 40-49 Hard to maintain code.
# 50-99 Unmaintainable code.
# 100-199 Crazy making difficult code.
# 200+ I only wish I were kidding.
.PHONY: complexity
complexity:
complexity $(COMPLEXITY_SRC)
# sudo apt install sloccount
.PHONY: sloccount
sloccount:
sloccount .
.PHONY: clean
clean: ports-clean
$(MAKE) -s -C src clean
+2
View File
@@ -24,6 +24,8 @@ package "gitg"
package "tofrodos"
package "clang-format"
package "sloccount"
package "complexity"
package "pmccabe"
# install ARM compiler and debugging tools
package "gcc-arm-none-eabi"
+20 -18
View File
@@ -1,10 +1,12 @@
SLOC Directory SLOC-by-Language (Sorted)
84560 ports ansic=70066,asm=9265,cpp=4651,xml=424,sh=154
72724 src_bacnet ansic=72724
15569 apps ansic=15011,perl=463,javascript=91,sh=4
721 test ansic=721
257 bin sh=257
5 top_dir sh=5
118011 ports ansic=101988,asm=10755,cpp=4651,xml=463,sh=154
78632 src_bacnet ansic=78632
28295 test ansic=27663,cpp=598,xml=34
22418 apps ansic=21856,perl=463,javascript=89,sh=10
644 build ansic=610,xml=34
565 zephyr ansic=565
302 bin sh=302
112 top_dir sh=112
0 cmake (none)
0 doc (none)
0 license (none)
@@ -12,24 +14,24 @@ SLOC Directory SLOC-by-Language (Sorted)
Totals grouped by language (dominant language first):
ansic: 158522 (91.19%)
asm: 9265 (5.33%)
cpp: 4651 (2.68%)
perl: 463 (0.27%)
xml: 424 (0.24%)
sh: 420 (0.24%)
javascript: 91 (0.05%)
ansic: 231314 (92.91%)
asm: 10755 (4.32%)
cpp: 5249 (2.11%)
sh: 578 (0.23%)
xml: 531 (0.21%)
perl: 463 (0.19%)
javascript: 89 (0.04%)
Total Physical Source Lines of Code (SLOC) = 173,836
Development Effort Estimate, Person-Years (Person-Months) = 45.00 (539.96)
Total Physical Source Lines of Code (SLOC) = 248,979
Development Effort Estimate, Person-Years (Person-Months) = 65.61 (787.38)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 2.28 (27.30)
Schedule Estimate, Years (Months) = 2.63 (31.51)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 19.78
Total Estimated Cost to Develop = $ 6,078,387
Estimated Average Number of Developers (Effort/Schedule) = 24.99
Total Estimated Cost to Develop = $ 8,863,648
(average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.