Codeformatierung mit indent



  • Hallo
    Ich habe mich die letzten Tage mal etwas mit Gnu Indent auseinandergesetzt.
    Finde das tool recht geil.
    Nur ist es etwas schwer sich alles richtig einzustellen.
    Jeder hat halt seinen eigenen geschmack. Wie man im wikipedia nachlesen kann, haben sich so 4-5 Standards durchgesetzt.

    Indent unterstützt von Hause aus schon 3 der 4-5.
    Leider wollte ich natürlich den 4. haben.

    Somit habe ich dann meine eigene .indent.pro zusammengebaut.

    Wäre mal interessant wie eure aussieht.

    Hier kommt meine:

    -kr
    --no-tabs
    --dont-break-procedure-type
    --declaration-indentation 0
    --braces-on-if-line
    --cuddle-else 
    --line-comments-indentation 0
    --no-space-after-function-call-names
    --no-space-after-casts 
    --dont-break-function-decl-args-end 
    --dont-break-function-decl-args
    //Use line length 150
    -l150
    


  • meine sieht wie folgt aus:

    /* Forces blank lines after the declaration */
    	/* ---------------------------------------- */
    -bad 
    	/* Forces blank lines after procedure bodies */
    	/* ----------------------------------------- */
    -bap 
    	/* Force blank lines before block comments */
    	/* --------------------------------------- */
    //-bbb 
    	/* Do not prefer to break long lines before boolean operators */
    	/* ---------------------------------------------------------- */ 
    -nbbo
    	/* Blank lines after comma in declaration */
    	/* -------------------------------------- */
    -bc 
    	/* Put braces on line after if, etc. */
    	/* --------------------------------- */
    -bl 
    	/* Indent braces n spaces */
    	/* -----------------------*/
    -bli0
    	/* Put braces on the line after struct declaration lines */
    	/* ----------------------------------------------------- */
    -bls
    	/* Blank before sizeof */
    	/* ------------------- */
    -bs
    	/* Put comments to the right of code in column n */
    	/* --------------------------------------------- */
    -c25
    	/* Indent braces after a case label N spaces */
    	/* ----------------------------------------- */
    -cbi3
    -cd20
    -ncdb
    -ncdw
    -nce
    	/* Continuation indent of n spaces */
    	/* ------------------------------- */
    -ci3
    	/* Case label indent of n spaces */
    	/* ----------------------------- */
    -cli3
    -cp33
    -cs
    -di20
    	/* Do not disable all formating of comment */
    	/* ----------------------------------------*/ 
    //-fca
    	/* Set maximum line length for non comment lines to n*/
    	/* --------------------------------------------------*/ 
    -l100
    	/* Set maximum line length for comment formating to n*/
    	/* --------------------------------------------------*/
    -lc90
    -npsl
    	/* Use spaces instead of tabs */
    	/* ---------------------------*/
    -nut
    	/* Put a space after every ( and before every )*/
    	/* --------------------------------------------*/
    -prs
    	/* Set tab size to n spaces*/
    	/* ------------------------*/
    -ts3
    

    mfg Paddy



  • Tabspace 3? Bist du Alternativer? :p

    MfG SideWinder



  • ist so vorgeschrieben bei uns :-((
    aber man gewöhnt sich daran



  • Ich muss sagen das ich es gut finde wenn alle in der Firma einen Standard haben.
    Man gewöhnt sich schneller drann als man denkt.

    Und wenn jemand Probleme damit hat kann man es ja schnell hin und her formatieren.
    Bei uns macht es leider jeder so wie er will.
    Somit habe ich mir einen "Standard" ausgesucht und den verwende ich nun.
    Ich bevorzuge den java/sun Stil der hier beschrieben ist
    http://de.wikipedia.org/wiki/Einrückungsstil#Bekannte_Einr.C3.BCckungsstile


Anmelden zum Antworten