• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tidy Code

 
Joe Cummins
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone.
I�m looking for a tool a little like HTML Tidy that indents and separates your code to the standard. I know it�s lazy but when you�re dipping in and out of code all day it gets a bit tedious. I know eclipse will format your code but it can�t seem to distinguish gaps in methods or between them. Any help would be great appreciated
Regards
Jez
 
Anubhav Anand
Ranch Hand
Posts: 341
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Cummins,
Welcome to JavaRanch.

I know eclipse will format your code but it can�t seem to distinguish gaps in methods or between them.


You can modify the inbuilt formatter of eclipse as per your convenience.

GOTO Window-->Prefrences-->Java-->Editor-->Save Actions
Check the box "Perform selected actions on save".
Now, click on formatter.
On the window click on New and write your custom formatter name anad choose any of the inbuilt formatters to start and say save.

Now, edit your formatter as per will.
 
Joe Cummins
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the welcome Anubhav and for the responce. Is there any kind of standard when it comes to java code or id it per coders prefrence?

Regards
Jez
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Cummins:
...Is there any kind of standard when it comes to java code or id it per coders prefrence? ...

It depends on who you ask.

Sun has documented the following: Code Conventions for the Java Programming Language.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They ought to update that conventions document; it is dated 1999. Most of it is easy to read, but there are a few bits, like ANSI constants, and "what you would put in a struct if Java had structs" which people posting on this forum can't be expected to understand.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They actually have made some changes since then - I found an old copy I'd made in 2003 which showed some differences. But I agree, talk of ANSI constants and structs is not so helpful to newer programmers today.
 
Joe Cummins
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers guys, most informative.
Regards
Jez
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic