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 9145373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:29:51+00:00 2026-06-17T10:29:51+00:00

After running Sonar on one of my project I get a violation for ‘trailing

  • 0

After running Sonar on one of my project I get a violation for ‘trailing comments’. So I wonder, is this purely related to accepted/recommended code layout conventions for Java or is there ‘more to it’? What’s the reasoning behind it? When I’m looking over some C++ code ( recent Doom code review, there are tons (or binder full of) trailing comments.

  • 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-06-17T10:29:52+00:00Added an answer on June 17, 2026 at 10:29 am

    From the famous book Code Complete:

    • The comments have to be aligned so that they do not interfere with the visual structure of the code. If you don’t align them neatly, they’ll make your listing look like it’s been through a washing machine.

    • Endline comments tend to be hard to format. It takes time to align them. Such time is not spent learning more about the code; it’s dedicated solely to the tedious task of pressing the spacebar or tab key.

    • Endline comments are also hard to maintain. If the code on any line containing an endline comment grows, it bumps the comment farther out, and all the other endline comments will have to bumped out to match. Styles that are hard to maintain aren’t maintained.

    • Endline comments also tend to be cryptic. The right side of the line doesn’t offer much room and the desire to keep the comment on one line means the comment must be short. Work then goes into making the line as short as possible instead of as clear as possible. The comment usually ends up as cryptic as possible.

    • A systemic problem with endline comments is that it’s hard to write a meaningful comment for one line of code. Most endline comments just repeat the line of code, which hurts more than it helps.

    Having said that, it’s also about one’s choice about coding style. I would personally avoid trailing comments as they don’t help that much.

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

Sidebar

Related Questions

I get this heap corruption detected message after running this code : uli& uli::operator
After running into this question today: Grails query not using GORM I wonder if
After running the code below I get this output: Eve 1200 Could anyone explain
After running my program I get this beautifully formatted text: What do I need
After running code from my previous question , I get a result set from
After running this query statement with my database: select * from articles where content
After running a new Play-framework 2.0 based project, i failed to clean it -
After running exec sp_lock on one of our databases we found there's close to
When I run make (after running qmake) I get the following error: /usr/bin/ld: cannot
After running rails generate controller home index in my Rails application, I see this

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.