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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • 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

How to define maxComplexity for methodContexts in maven clover plugin configuration


I want to customize clover coverage reports to exclude simple methods (setters/getters) with complexity less than 2. It's possible with Ant plug-in.

Сonfiguration example:

<clover-setup ...>
<!-- Don't instrument methods which have cyclomatic complexity <= 1 or <= 3 statements -->
<methodContext name="simple_method" regexp="(.* )?public .*(get|set|is)[A-Z0-9].*" " maxComplexity="1"/>
But It seems the same configuration can not be defined with maven clover plug-in. In maven plug-in only regexp can be defined.
<simple_method>((.* )?public .*(get|set|is)[A-Z0-9].*</simple_method>>
Are there any ways/workarounds to define maxComplexity as one of criteria for filtered code?

2 answers

0 votes

Unfortunately, maxComplexity/maxStatements are not available in Maven plugin right now (version 3.1.7). I've created CLOV-1173 improvement request for this. As a workaround you could try using the Maven Antrun Plugin and calling Clover from it.


Can we use a regex like below to eliminate Getter/Setters using methodContext in Maven ? 

<getterSetter>(?m)((?:public |private |protected )?[\w$]+) (get|set|is)([\w$]+)\(([\w$]+(?:\[\])? [\w$]+)?\) \{\s+(return [\w$]+;|this.[\w$]+ = [\w$]+;)\s+\}</getterSetter>

No. The methodContext matches method's signature (i.e. annotations + modifiers + return type + name + arguments) and not method's body.

Besides - your regexp part for method's signature is unnecessarily complex - Clover performs signature normalisation before comparison, see

Suggest an answer

Log in or Sign up to answer
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...

163 views 2 8
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