1. Sometimes we run build script by disabling this option
2. Sometimes we ignore the result and continue with the build
3. End up little time to fix issues
To avoid such problems, it is always good to incorporate code review step as part of development. This is very useful to find out major issues such as releasing resources, memory management and design related issues. We may not be able to run full code coverage testing all the time.
Above issues can lead to fatal, because same resource needs to be accessed by multiple applications in integration environment. Other team testing/development will also be affected because of this problem.
We often wrap the resource classes and release as a common package. Simple example is I am sure each and every company must have their own db package with connection pool. So code review tool has to be customized to incorporate resource release for the wrapper classes. Found PMD is very useful for Java code review.
PMD can be integrated with Eclipse and can be customizable to deifne our own priority.
Step by step setup:
http://www.devx.com/Java/Article/31286/0/page/1
How to customize rule?
http://www.onjava.com/pub/a/onjava/2003/04/09/pmd_rules.html
Customizing resource release rule for wrapper class, Once installed enable PMD for the particular project in Eclipse.
- Goto Window > preferences > PMD > Rules Configuration
- Select closeResource and change Priority to “Error High”
- Add types and closeTargets
- types represents – Object name (like DBPool)
- closeTargets – represents method name to release the resource (like close,destroy,disconnect)
Once it is done, rules can exported and distributed to others.
I found following are good about using PMD with eclipse
1. Whenever code is saved it will be executed in Eclipse and developer can correct at the time of development itself
2. Same can be incorporated with build process also
3. Most of the issues are closed at the time of coding
1 comment:
Great work.
Post a Comment