문제

I am searching for a Cyclomatic Complexity Api in Delphi (2010). I need to create a program that will analize a source code and report the Cyclomatic Complexity of all methods in all classes (just like SourceMonitor does).
I cant use other softwares, I really need to build one.
Does anyone knows an API for delphi 2010 that does that?

도움이 되었습니까?

해결책

You'll need a language parser from which you can generate a control flow graph. Then you need to calculate the CC using this formula.

I know of no library that will do this for you.

You may be able to use the free pascal source to generate the control flow graph (its a common technique used in compilers to eliminate unreachable code).

Unfortunately, Delphi hasn't shipped with a complete formal definition(bnf grammar) of the language in its documentation since Delphi 6 I believe. (even then it wasn't completely accurate) So all third party parsers are shooting in the dark.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top