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

add line_to_ccn={line:ccn} #306

Open yql70 opened 3 years ago

yql70 commented 3 years ago

helo~ I want a new field to show the relationship between line and cyclomatic complexity, like this: image So I added a variable line_to_ccn in the FunctionInfo class, to record lines of code and add up the ccn in add_condition(). I also output line_to_ccn in csv files.

terryyin commented 3 years ago

Hi Kylin,

What an interesting idea! Is there a resource I can learn more about it? Thanks!

Sorry I cannot accept the pull request like this. There are two problems:

  1. It doesn’t come with tests
  2. It should probably be an extension (see https://github.com/terryyin/lizard/blob/master/lizard_ext/lizardgotocount.py https://github.com/terryyin/lizard/blob/master/lizard_ext/lizardgotocount.py for example)

I like the idea so I could do it later as well.

Terry

On 2 Dec 2020, at 11:20 AM, kylin-ye notifications@github.com wrote:

helo~ I want a new field to show the relationship between line and cyclomatic complexity, like this: https://user-images.githubusercontent.com/34933160/100823386-1576b180-348f-11eb-978b-ee7bbbc1f16c.png So I added a variable line_to_ccn in the FunctionInfo class, to record lines of code and add up the ccn in add_condition(). I also output line_to_ccn in csv files.

You can view, comment on, or merge this pull request online at:

https://github.com/terryyin/lizard/pull/306 https://github.com/terryyin/lizard/pull/306 Commit Summary

add line_to_ccn={line:ccn} File Changes

M lizard.py https://github.com/terryyin/lizard/pull/306/files#diff-3b90d7faaa441402a7d90c3cac5fa56cb63a4afa8ee464e85183bb24a8d67431 (5) M lizard_ext/csvoutput.py https://github.com/terryyin/lizard/pull/306/files#diff-8a9e4c0a28c1c60507f71de672ea8e0f9af725e77db40ecb9febf865981e08be (7) Patch Links:

https://github.com/terryyin/lizard/pull/306.patch https://github.com/terryyin/lizard/pull/306.patch https://github.com/terryyin/lizard/pull/306.diff https://github.com/terryyin/lizard/pull/306.diff — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/terryyin/lizard/pull/306, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGASYQR3IQUGJDCJYTLTD3SSWXBDANCNFSM4UJ4OAOQ.

yql70 commented 3 years ago

This idea references the html output of dart-code-metrics, cyclomaticComplexityLines records the relationship between line and ccn. It may be an extension. Looking forward to adding this feature. Thanks!