heuza / google-styleguide

Automatically exported from code.google.com/p/google-styleguide
0 stars 0 forks source link

Patch for /trunk/eclipse-java-google-style.xml #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Enable the on/off tags (@formatter:off, @formatter:on) so that comments can be 
formatted manually in exceptional cases, such as to provide an ASCII table in a 
comment to describe a block of code's expected behavior to other developers, 
when the formatting rules would have made the comment less readable by 
collapsing whitespace and line-wrapping. This feature exists already in 
Eclipse, and is enabled by this patch.

Example:
/*
 * The following method returns the following results
 * @formatter:off
 * +-------+-------+-------------------+
 * | c="a" | c="b" |    anything else  |
 * +-------+-------+-------------------+
 * | true  | false | true iff f(c)>200 |
 * +-------+-------+-------------------+
 * @formatter:on
 */
public boolean myMethod(String c);

Original issue reported on code.google.com by ctubbsii on 15 Aug 2014 at 10:44

Attachments:

GoogleCodeExporter commented 9 years ago
So, this has become more important now, because I've realized that Eclipse 
cannot enforce the column limit[1] in some cases. It ignores trailing 
punctuation and other issues[2]. This means that formatting in Eclipse is not 
possible in all cases, unless a way is provided to bypass the Eclipse formatter 
with some manual solution[3].

This allows projects to enforce the style guide with an automated build tool, 
such as checkstyle, but still develop/format in Eclipse.

Please apply the provided patch to enable compliance with the maximum columns 
guideline through manual intervention against the buggy Eclipse formatter.

[1]: 
http://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s4.4-column-lim
it
[2]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=455852 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=303519 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=76633 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=110569 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=179796
[3]: 
http://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s4.5-line-wrapp
ing

Original comment by ctubbsii on 23 Dec 2014 at 10:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated git formatted patch from 
https://github.com/ctubbsii/google-styleguide/tree/issue-27

Original comment by ctubbsii on 23 Dec 2014 at 11:19

Attachments: