You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by COFFMAN Steven <SC...@CBSINC.com> on 2000/09/18 20:25:50 UTC

coding practices:Jstyle

Lovely!

Everyone has their own style of code formatting. 2-5 spaces per indent, Tabs
vs. spaces, whether the "{" goes on a new line, etc. Despite everyone's best
efforts to be consistant, FOP's code is a mixed bag. 

However, JStyle is a rather nice code formatter/beautifier with lots of
options. I recommend we use it before we commit. You can convert to your own
style before you edit, and back to standard before you commit. 

For instance, if you like using tabs instead of spaces, having the '{' on a
new line, you can use:
cat mysource.java | java jstyle.JSFormatter -b | java jstyle.JSBeautifier -t
> newsource.java

And then right before you commit changes, you can do this:
cat newsource.java | java jstyle.JSFormatter | java jstyle.JSBeautifier >
newsource.java

You can get it from Cocoon2's lib directory:
cvs -d :pserver:anoncvs@xml.apache.org:/home/cvspublic checkout -r
xml-cocoon2 xml-cocoon

What's everyone think?
-Steve
-----Original Message-----
From: Giacomo Pati [mailto:pati_giacomo@yahoo.com]
Sent: Monday, September 18, 2000 9:27 AM
To: Java Apache Framework
Subject: Re: [VOTE] Proposed Actions



--- Peter Donald <do...@mad.scientist.com> wrote:
> At 03:17  18/9/00 -0700, you wrote:
> >agree but that's not an issue at all... distribution sources will go
> >throught a formatter that will do the job for us. :-)
> 
> Is there a free formatter - kevin said he was hoping to add it to one
> of
> the projects he ran but as far as I am aware there is only the cf one
> from
> IBM that is free (and that only formats a certain fixed way).

I haven't followed all the mails of this thread, but if you talk about
source code formatter there is a free one in the C2 CVS call JStyle
(lib/js.jar) and is used as follows:

   cat source.java | \
      jstyle.JSFormatter | \
      jstyle.JSBeautifier > newsource.java

or look at
src/org/apache/cocoon/components/language/programming/java/JstyleFormatter.j
ava
as an example how to use it programmatically.

Giacomo

=====
--
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/


------------------------------------------------------------
To subscribe:    java-apache-framework-on@list.working-dogs.com
To unsubscribe:  java-apache-framework-off@list.working-dogs.com
Problems?:       jon@working-dogs.com

Re: coding practices:Jstyle

Posted by Fotis Jannidis <fo...@lrz.uni-muenchen.de>.
> At 02:25 PM 9/18/00 -0400, COFFMAN Steven wrote:
> >However, JStyle is a rather nice code formatter/beautifier with lots of
> >options. I recommend we use it before we commit. You can convert to your own
> >style before you edit, and back to standard before you commit. 
> 
> +1 as far as I'm concerned.

+1 
Fotis

Re: coding practices:Jstyle

Posted by Christian Geisert <Ch...@isu-gmbh.de>.
COFFMAN Steven wrote:
> 
> Lovely!
> 
> Everyone has their own style of code formatting. 2-5 spaces per indent, Tabs
> vs. spaces, whether the "{" goes on a new line, etc. Despite everyone's best
> efforts to be consistant, FOP's code is a mixed bag.

My favoured indention is 4 spaces ;-)

Under http://xml.apache.org/source.html is written that
"All Java Language source code in the repository must be written in conformance
to the Code Conventions for the Java Programming Language as published by Sun"
Has anybody noticed this?

> However, JStyle is a rather nice code formatter/beautifier with lots of
> options. I recommend we use it before we commit. You can convert to your own
> style before you edit, and back to standard before you commit.
> ...
> You can get it from Cocoon2's lib directory:
> cvs -d :pserver:anoncvs@xml.apache.org:/home/cvspublic checkout -r
> xml-cocoon2 xml-cocoon

I'll have a look at it in the next days

> What's everyone think?

I think it is a good idea (I had similar thoughts) and hope it fixes my
problems with some source-files (e.g. in the image-package) where diff
returned me the full source.

> -Steve

Adios,
  Christian

Re: coding practices:Jstyle

Posted by Keiron Liddle <ke...@aftexsw.com>.
Arved_37@chebucto.ns.ca wrote:

> Here's one version:
>
> http://www.redrival.com/greenrd/java/jstyle/
>
> and you can download a ZIP. Dunno if it's the latest but I get the impression
> it is.

The reason I asked about the source has become apparent.
It seems there is a bug in jstyle, JSFormatter.
If a file is formatted twice then it it gives slightly different results.
It looks like it hapens in comments (javadoc?) after an inner class, which
occurs a lot in the fop code.
It keeps adding an extra space before any text each time it is formatted.

Keiron


Re: coding practices:Jstyle

Posted by Ar...@chebucto.ns.ca.
Hi, Keiron

Here's one version:

http://www.redrival.com/greenrd/java/jstyle/

and you can download a ZIP. Dunno if it's the latest but I get the impression 
it is.

Arved

Quoting Keiron Liddle <ke...@aftexsw.com>:

> +1
> 
> I agree we should try to have a consistent style.
> 
> I do have some related issues though
> - the actual program appears to have changed to astyle which is in written
> in
> C++ only
> http://astyle.sourceforge.net/
> and seems a bit buggy. The java jstyle seems to have dissapeared. Does
> anyone
> know what is hapening with the project. It would be good if jstyle had the
> features of both jstyle and astyle.
> 
> - if you change a file to you own style and then it is updated through cvs
> it
> will cause conflicts.
> 
> Arved Sandstrom wrote:
> 
> > +1 as far as I'm concerned.
> >
> > If we vote for it then we can quickly decide how to integrate it into our
> > docs and procedures.
> 


---------------------------------------------------------------
 This mail was sent through the Nova Scotia Provincial Server, 
 with technical resources provided by Chebucto Community Net.
 http://nsaccess.ns.ca/mail/         http://www.chebucto.ns.ca/


Re: coding practices:Jstyle

Posted by Keiron Liddle <ke...@aftexsw.com>.
+1

I agree we should try to have a consistent style.

I do have some related issues though
- the actual program appears to have changed to astyle which is in written in
C++ only
http://astyle.sourceforge.net/
and seems a bit buggy. The java jstyle seems to have dissapeared. Does anyone
know what is hapening with the project. It would be good if jstyle had the
features of both jstyle and astyle.

- if you change a file to you own style and then it is updated through cvs it
will cause conflicts.

Arved Sandstrom wrote:

> +1 as far as I'm concerned.
>
> If we vote for it then we can quickly decide how to integrate it into our
> docs and procedures.


Re: coding practices:Jstyle

Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
At 02:25 PM 9/18/00 -0400, COFFMAN Steven wrote:
>However, JStyle is a rather nice code formatter/beautifier with lots of
>options. I recommend we use it before we commit. You can convert to your own
>style before you edit, and back to standard before you commit. 

+1 as far as I'm concerned.

If we vote for it then we can quickly decide how to integrate it into our 
docs and procedures.

Arved
Senior Developer
e-plicity.com (www.e-plicity.com)
Halifax, Nova Scotia
"B2B Wireless in Canada's Ocean Playground"