Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 824093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:02:55+00:00 2026-05-15T03:02:55+00:00

At work we are using several tools to capture several metrics (mostly cyclomatic complexity

  • 0

At work we are using several tools to capture several metrics (mostly cyclomatic complexity and LCOM). We use those to get warning flags and to guide pre-emptive refactoring efforts. It’s been very beneficial in increasing code quality.

However, the process is not tied to the build process. It is conducted separately. Moreover, I’m looking for something that can be made intrinsic to the source code (as opposed to an external process ran on it.)

Is anyone aware of a group of annotations and configurable annotation processor(s) that can be run from the compiler, and which will make the build fail if code doesn’t comply with threshold cyclomatic/LCOM metrics?

I guess I could run ckjm, checkstyle and pmd from maven/ant, BUT some work on source code, and others work on bytecode. It would be nice to have one consolidated tool that works on the source code before compilation begins.

The other thing is that it’d be nice if there are sets of annotations that could drive this (to allow customization that will be inevitably be needed for corner cases.)

@LCOM3(Threshold=1.5)
public class SomeDumbPojo {... buch of gets/sets...}

// by default would be measured against a strict LCOM3
public class ActualBizClass
{
   @CYCLOMATIC_COMPLEXITY(Threshold=15)
   public void someFatIrreducibleMethod(){...}
}

Then, when we run the tool, by default applies strict (and configurable) metric threshold except on those artifacts that are annotated with (hopefully documented and legitimate) more relaxed thresholds. For some methods that cannot/should not be reduced, a relaxed cyclomatic complexity makes sense. For plain POJOs w/o behavior, LCOMs need to be relaxed… and so forth and so forth.

Looking and googling as I might, I have not been able to find anything (hopefully open source). But I might as well ask here just in case anyone is aware of anything of the sort.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:02:56+00:00Added an answer on May 15, 2026 at 3:02 am

    It would be nice to have one consolidated tool that works on the source code before compilation begins.

    I’m not quite sure what this means as the code has to be compiled into something in order for static analysis to work. All of these tools need to be able to compile your code either into bytecode or some sort of syntax tree.

    I would suggest keeping it simple: configure PMD to fail the build if any warnings for Cyclomatic Complexity or other metrics cross a given threshold. Instead of annotating the method with the allowable complexity (how would you derive an accepted value? what’s to prevent someone who accidentily increased the complexity from 12 to 15 to just bumping up the annotation), annotate it to suppress the warning completely

    @SuppressWarnings("PMD.CyclomaticComplexity")
    public void someFatIrreducibleMethod() { ... }
    

    And then periodically you can search your codebase for methods with suppressed warnings that you might want to remove and refactor.

    Alternatively, PMD has support for leaving comments in the code in a certain syntax to mark who audited the warning and when, if you’d like to provide some sort of traceability.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Grasping at straws here... I work with a VB6 desktop system using several 2003-style
I work on a Webproject using jQuery and CakePHP. I use jeditable as an
If I wanted to work using dates and time going millions of years into
I have a SOAP request that is known to work using a tool like,
I have a fairly large PHP codebase (10k files) that I work with using
At work I'm using Perl 5.8.0 on Windows. When I first put Perl on,
I recently got involved in a Java project at work: we're using MyEclipse for
While using Vim (at home and at work), I often find myself doing similar
A using declaration does not seem to work with an enum type: class Sample{
At work we are currently still using JUnit 3 to run our tests. We

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.