What do you think about using 2 spaces for XMLs? I think maven guys use this convention and it looks nice
On Mon, Sep 6, 2010 at 7:36 PM, Michael Neale <[email protected]> wrote: > 4 spaces makes sense. Tabs would be a mistake and misconfigured IDE. > I have heard that for "dense" languages - people like 2 space indents (its > recommended in scala - which I spend most of my time). > But I think DRL would look a bit funny with 2 spaces - 4 does make sense, as > DRL lines aren't very long - they don't need to be ! > Nice work picking this up geoffrey - and yes, in the past I was bitten by > merge hassles. > > On Tue, Sep 7, 2010 at 2:36 AM, Mark Proctor <[email protected]> wrote: >> >> yes it should be 4 spaces. >> >> Mark >> On 06/09/2010 14:20, Geoffrey De Smet wrote: >> > Hi guys, >> > >> > Looks like we have different ways of indent our files. >> > I 've seen these occurrences for a single indentation on drools trunk: >> > - java files: >> > -- 4 spaces >> > -- 1 tab >> > - xml files: >> > -- 4 spaces >> > -- 3 spaces >> > -- 2 spaces >> > -- 1 tab >> > - drl files: >> > -- 4 spaces >> > -- 2 spaces >> > -- 1 tab >> > I've seen different types mixed in the same line regularly. One >> > developer created the line, another developer wrapped it in an if >> > statement. >> > >> > The problem >> > =========== >> > What's the problem with mixing these different types? >> > - It stimulates merge conflicts. >> > - It obfuscates diffs. >> > - It hampers with readability. >> > Some editors show \t as 2 spaces, others as 4, others as 8. Most >> > notably, in plain HTML, firefox etc show it as 8 spaces IIRC. >> > So line A with 2 indentations of 4 spaces each >> > and line B with 2 indentations of 1 tab each >> > are not rendered starting from the same column. >> > >> > The solution proposals >> > ====================== >> > We should agree on what to use. >> > Then simply configure it in eclipse/intellij: >> > - In eclipse you need to set it several times: >> > -- once in the java style (or import the eclipse-formatter.xml) >> > -- once in the xml style (even if you import the eclipse-formatter.xml >> > file) >> > -- once in the text style (even if you import the eclipse-formatter.xml >> > file) >> > - In intellij, do it in code style/general. >> > >> > >> > Proposal 1) Use 4 spaces in java, xml and drl to indent. >> > Pro: >> > - The current drools eclipse formatter, trunk/eclipse-formatter.xml >> > states this for java files. Note that it says nothing about xml or drl >> > files because those need to be configured separately in eclipse, which >> > is probably the reason why some of use spaces for java files and tabs >> > for xml files. >> > - Most of our java files currently use 4 spaces >> > - The "Sun java coding conventions" state we should use 4 spaces. >> > http://www.oracle.com/technetwork/java/codeconventions-136091.html#262 >> > "Four spaces should be used as the unit of indentation." >> > >> > Proposal 2) Use 4 spaces in java and 2 spaces in xml and drl >> > Pro: >> > - xml files can have deep indentations and 2 spaces might be clear >> > enough >> > >> > Proposal 3) Use 1 tab in java, xml and drl to indent. >> > Pro: >> > - Eclipse uses 1 tab by default for xml files (and maybe also for java >> > files?) >> > >> > My opinion (vote?) >> > ================== >> > >> > Proposal 1) Use 4 spaces in java, xml and drl to indent. >> > >> > PS >> > == >> > Please keep this topic isolated to the spaces VS tabs problem. >> > If you'd like to open the topic of the coding style which differs >> > between developers, please do so in a separate topic, as that one can be >> > long and unfulfilling discussion and I 'd like to settle the spaces >> > quickly... >> > >> >> >> _______________________________________________ >> rules-dev mailing list >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-dev > > > > -- > Michael D Neale > home: www.michaelneale.net > blog: michaelneale.blogspot.com > > _______________________________________________ > rules-dev mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-dev > > -- diego _______________________________________________ rules-dev mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-dev
