Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to exlude methods from coverage metrics based on complexity? (maven)

There are a large number of bean classes in a project that I'm working on, (in the 100s), and I'd like to be able to exclude the simple property methods from code coverage metrics. I had been excluding all bean classes at first, then switched to excluding property methods.

The problem with both of these is that some of the beans have at least a small amount of logic in the getter and setter methods; these I feel should be considered for code coverage metrics.

Ideally, I would be able to exclude any methods that are < 3 lines and have a complexity of 1, but I've been unable to find a way to do this in Clover for Maven.

1 answer

0 votes

Hi Nick,

You can exclude certain methods based on their number of statements or complexity, but only using Clover-for-Ant - see the <clover-setup> / <methodContext> element, the 'statements' / 'aggregatedStatements' / 'complexity' / 'aggregatedComplexity' attributes.

In case of Clover-for-Maven, the configuration option is simplified and you can define only method's name using a regular expression. There is an improvement request raised to add statements and complexity attributes:

https://jira.atlassian.com/browse/CLOV-1173

and it's scheduled for Clover 4.1.1 at the moment (end of 2015 probably); but feel free to contribute if you need this urgently - sources are on https://bitbucket.org/atlassian/maven-clover2-plugin/.

 

Cheers
Marek

Thanks Marek - it's not really urgent, just trying to convince my team of the value of these metrics, and figure the more accurate they are the easier that will be. I may take a look at the source - thanks for the link.

I case you'd decide to check sources - it's in com.atlassian.maven.plugin.clover.internal.AbstractCloverInstrumentMojo. Cheers!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Jira Cloud Performance Improvements

Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...

178 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you