terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.85k stars 250 forks source link

TTCN-3 language support #74

Closed gustafj closed 9 years ago

gustafj commented 9 years ago

This adds support for the TTCN-3 language which is a strongly typed compiled language for conformance testing. It is imperative and "C-like" with a few special constructs.

In TTCN there is the concept of testcase and control "functions" these special constructs are in lizards output prefixed with __testcase__ and __control__ respectively (to be able to distinguish between them and ordinary functions since they are special) please comment if you want this solved in a any other way.

Sample output:

> ~/Development/python-lizard/lizard -V comptest.ttcn
================================================
  NLOC    CCN   token  PARAM  length  location  
------------------------------------------------
       9      1     71      0       9 createconfig@65-74@comptest.ttcn
       3      1     20      0       2 donestop@76-78@comptest.ttcn
       4      3     26      1       3 neg@80-83@comptest.ttcn
      12      3     92      3      13 send_receive@87-100@comptest.ttcn
      24      8    157      3      25 relay_x@150-175@comptest.ttcn
       7      1     59      0       6 __testcase__comptest_1@203-209@comptest.ttcn
       7      1     59      0       6 __testcase__comptest_2@217-223@comptest.ttcn
       7      1     59      0       6 __testcase__comptest_4@249-255@comptest.ttcn
      13      2     96      1      12 __testcase__comptest_5@262-274@comptest.ttcn
      11      1     93      0      11 __testcase__comptest_6@284-295@comptest.ttcn
       8      1     47      0       9 __control__@315-324@comptest.ttcn
--------------------------------------------------------------
1 file analyzed.
==============================================================
NLOC    Avg.NLOC AvgCCN Avg.ttoken  function_cnt    file
--------------------------------------------------------------
    141      9    2.0        70        11     comptest.ttcn

=================================================================
!!!! Warnings (CCN > 15 or arguments > 100 or length > 1000) !!!!
================================================
  NLOC    CCN   token  PARAM  length  location  
------------------------------------------------
==========================================================================================
Total nloc  Avg.nloc  Avg CCN  Avg token  Fun Cnt  Warning cnt   Fun Rt   nloc Rt  
------------------------------------------------------------------------------------------
       141         9     2.09      70.82       11            0      0.00    0.00

Further reading if interested: https://en.wikipedia.org/wiki/TTCN-3 http://www.ttcn-3.org/

terryyin commented 9 years ago

@gustafj this is cool! Thanks.

I will create a new release this weekend.

terryyin commented 9 years ago

I removed some duplicated code, which was reported by pylint.

gustafj commented 9 years ago

Nice! Looked at the refactoring you did and it looks good apart from one small comment, see: 3aa01b21ec3ef9bd106243f9c962a61184cdc7d6

Thanks for merging!

terryyin commented 9 years ago

Thanks:-) My tests say [')', '>' '>>’] and ‘)>>>’ works the same:-)

On 22 Oct 2015, at 2:52 PM, gustafj notifications@github.com wrote:

Nice! Looked at the refactoring you did and it looks good apart from one small comment, see: 3aa01b2 https://github.com/terryyin/lizard/commit/3aa01b21ec3ef9bd106243f9c962a61184cdc7d6 Thanks for merging!

— Reply to this email directly or view it on GitHub https://github.com/terryyin/lizard/pull/74#issuecomment-150124610.

gustafj commented 8 years ago

@terryyin Any progress on creating a new release?

terryyin commented 8 years ago

Sorry! totally forget. Done:-)

gustafj commented 8 years ago

Great! Thank you!