Create a new Complexity check

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Create a new Complexity check

Joao Morais-2
Hello List.

I need to implement a new Checkstyle check which is based on the
CyclomaticComplexityCheck class. The check need to verify the amount
of methods of packages M[], whose CCN is between X and Y. The result
cannot be more than Z% of the methods.

There are at least two approaches. The first one, extending
CyclomaticComplexityCheck or AbstractComplexityCheck, I don't know how
(if possible) to persist the current result between visitor's calls.
Otoh extend AbstractFileSetCheck sounds time and resource consuming.

Are there other approaches or something I am missing?

Thanks

Joao Morais

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
Reply | Threaded
Open this post in threaded view
|

Re: Create a new Complexity check

Oliver Burn
It is possible to persist information across calls. The instance of the Check is created once and used.

If you extend AbstractComplexityCheck, you can override beginTree() and endTree() to know when processing starts and finishes. You will need to copy the implementation of visitTokenHook() to determine the complexity of each method.

Probably need to add hooks to determine package names as well.

Regards,
Oliver 

On Wed, Dec 16, 2009 at 00:01, Joao Morais <[hidden email]> wrote:
Hello List.

I need to implement a new Checkstyle check which is based on the
CyclomaticComplexityCheck class. The check need to verify the amount
of methods of packages M[], whose CCN is between X and Y. The result
cannot be more than Z% of the methods.

There are at least two approaches. The first one, extending
CyclomaticComplexityCheck or AbstractComplexityCheck, I don't know how
(if possible) to persist the current result between visitor's calls.
Otoh extend AbstractFileSetCheck sounds time and resource consuming.

Are there other approaches or something I am missing?

Thanks

Joao Morais

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
Reply | Threaded
Open this post in threaded view
|

Re: Create a new Complexity check

Joao Morais-2
On Wed, Dec 16, 2009 at 12:15 AM, Oliver Burn <[hidden email]> wrote:
> It is possible to persist information across calls. The instance of the
> Check is created once and used.
> If you extend AbstractComplexityCheck, you can override beginTree() and
> endTree() to know when processing starts and finishes. You will need to copy
> the implementation of visitTokenHook() to determine the complexity of each
> method.
> Probably need to add hooks to determine package names as well.

Hello Oliver. Thanks for your hints. Is there a way to receive a
notification that all files was checked? The check need to compare
methods across different classes.

Joao Morais

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
Reply | Threaded
Open this post in threaded view
|

Re: Create a new Complexity check

Oliver Burn
Actually the Check API does not let you know when all files have been
processed. This is probably a deficiency in the API.

You could try a major hack and use the destroy() method, which may or
may not work.

Regards,
Oliver

On 16/12/2009 10:02 PM, Joao Morais wrote:

> On Wed, Dec 16, 2009 at 12:15 AM, Oliver Burn<[hidden email]>  wrote:
>    
>> It is possible to persist information across calls. The instance of the
>> Check is created once and used.
>> If you extend AbstractComplexityCheck, you can override beginTree() and
>> endTree() to know when processing starts and finishes. You will need to copy
>> the implementation of visitTokenHook() to determine the complexity of each
>> method.
>> Probably need to add hooks to determine package names as well.
>>      
> Hello Oliver. Thanks for your hints. Is there a way to receive a
> notification that all files was checked? The check need to compare
> methods across different classes.
>
> Joao Morais
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Checkstyle-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/checkstyle-user
>    

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user