The Open For Business projects follows the Sun coding standards for Java source code.
For information regarding this standard please visit http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
HTML code should be XHTML compliant. Groovy files should follow the same convention as Java files.
In accordance with this standard we use 4 space indention rather than tabs, and set the tab size to 8 spaces to make code with tabs easier to pick out. Make sure no code contains tab characters.
For XML/HTML/FTL files we follow the standard XML/HTML/FTL format (TODO: add link to a reference here). XML/HTML/FTL files should use 2 spaces instead of 4, but there are still number of files using 4 space indention. So it's better to keep the indentation used in each file to avoid confusion when committing.
We don't want tab characters in text files in SVN, because different editors and tools interpret tabs differently. All indentation should be done purely with spaces.
To change tabs to spaces in Eclipse, change these preferences in Window -> Preferences ->
1. Java -> Code Style -> Code Formatter -> Show... -> Java Conventions [built-in] -> Indentation, select Tab policy as "space only". Enter a new name for this profile and click "OK".
2. Java -> Editor -> Typing, and check "Insert spaces for tab".
3. Ant -> Editor -> Formatter, and uncheck "Use tab character instead of spaces".
4. If you installed Colorer, Colorer Library Editor -> Uses spaces instead of tabs.
5. If you installed XML Buddy, XMLBuddy -> Formatting -> Uses spaces instead of tabs.
6. If you installed Oxygen, Oxygen -> Editor -> Format -> uncheck Indent with tabs, indent size 4.
7. Unfortunaltely neither of the 2 main FreeMarker pluggin have similar functionnality yet. But there is a solution :
* Install AnyEdit plugin (http://andrei.gmxhome.de/eclipse/) and set its parameters in General -> Editors -> AnyEdit Tools. When using AnyEdit plugin, you should set it to
o Strip trailing whitespaces
o Create new line at the end of file
o Convert tab to space (it's by default in last versions)
In Eclipse, for Java, you may use Ctrl+I to be sure of correct indentation.
分享到:
相关推荐
Basic Visual Formatting in CSS
System.Net.Http.Formatting.dll
Excel: Formatting Microsoft Excel has many formatting options to make your spreadsheet more attractive and easier to read.
System.Net.Http.Formatting.xml
This document covers many aspects of programming with C#, from naming, structural and formatting conventions to best practices for using existing and developing new code.
System.Net.Http.Formatting 4.0各版本,asp.net C#.net 都能用到
System.Net.Http.Formatting
BFC是Box Formatting Context的缩写
Block Formatting Contexts Demo
含 各个版本,引用此DLL可解决C#HttpClient的不支持PostAsJsonAsync方法的问题
address-formatting, 设置地理地址格式的模板 电子邮件地址格式一个快速示例给定一组地址部件 house_number: 17 road: Rue du Médecin-Colonel Calbairac neighbourhood: Lafourguet
This section includes the following topicsPrerequisites What you need to know before reading this ...Time WorkshopEmbedded Coder.Typographical Conventions Formatting conventions used in this document
netbeans-psr-formatting, PSR 1 & 2的NetBeans配置设置 用于NetBeans的 PSR自动格式库提供了 PHP PSR1 和 PSR2标准的源代码自动格式设置。尽管并不提供对所有和 PSR2'规则'的自动格式支持( 例如。 重构类和方法名...
好多“条件格式”例子; 实用,易学; 从Office2007 Help
Formatting Dates, Times and Numbers in ASP.NET
About Desktop Intelligence Reporting Techniques and Formatting
最初随附为期2天的使用LaTeX排版系统的课程。
Serilog.Formatting.Log4Net是一个附加到格式的日志事件... Formatting . Log4Net ; static class Program { static void Main () { var logger = new LoggerConfiguration () . WriteTo . File ( new Log4NetTextF
前端开源库-strip-formatting删除格式,从每行输入中删除前导空格