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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 444k
  • Answers 445k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The - (void)session:(FBSession*)session didLogin:(FBUID)uid delegate method needed to be added. May 15, 2026 at 6:46 pm
  • Editorial Team
    Editorial Team added an answer I haven't tested the answer here but it seems sensible.… May 15, 2026 at 6:46 pm
  • Editorial Team
    Editorial Team added an answer Well, yes, instance variables aren't saved to the database (how… May 15, 2026 at 6:46 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.