Changes between Version 28 and Version 29 of DevelopersGuide/StyleGuide


Ignore:
Timestamp:
2016-01-30T07:14:41+01:00 (10 years ago)
Author:
kolesar
Comment:

automated checks

Legend:

Unmodified
Added
Removed
Modified
  • DevelopersGuide/StyleGuide

    v28 v29  
    1 [[TranslatedPages]] 
     1[[TranslatedPages]]
    22= Development Guidelines =
    33
     
    1010 * Document your code '''thoroughly'''. Many people will thank you :)
    1111 * add curly brackets for each {{{if}}}, unless it is followed by {{{return}}} (or maybe {{{throw}}})
     12 * check your changes before patch/commit: `ant checkstyle` and check `checkstyle-josm.xml`; if you find running checkstyle slow for all files, run for changed files only:
     13
     14{{{
     15    svn diff --summarize | awk '{ print $2 }' | xargs java -jar tools/checkstyle/checkstyle-6.14.1-all.jar -c tools/checkstyle/josm_checks.xml
     16    # or
     17    git diff --name-only | xargs java -jar tools/checkstyle/checkstyle-6.14.1-all.jar -c tools/checkstyle/josm_checks.xml
     18}}}
    1219
    1320== How your javadoc should look like ==
     
    1724   * {{{@since}}} can be omitted for public methods and fields introduced at the same time as the class, provided they do not have changed and the class is correctly documented.
    1825 * {{{@throws}}} is preferred to {{{@exception}}}
     26 * check your changes before patch/commit by generating javadoc: `ant javadoc`, browse output messages; if you find running javadoc slow for all files, run for changed files only:
     27
     28{{{
     29    svn diff --summarize | awk '{ print $2 }' | xargs javadoc -d javadoc
     30    # or
     31    git diff --name-only | xargs javadoc -d javadoc
     32}}}
    1933
    2034=== Configuring Eclipse ===
     
    3044== Internationalization ==
    3145
    32  * make sure you use {{{tr(...)}}} for all localized strings 
    33    {{{ 
     46 * make sure you use {{{tr(...)}}} for all localized strings
     47   {{{
    3448   import import static org.openstreetmap.josm.tools.I18n.tr;
    3549
     
    3852   throw new Exception(tr("error message always in tr()"));
    3953
    40    // use tr(...) for labels, title, tooltip texts and the like 
     54   // use tr(...) for labels, title, tooltip texts and the like
    4155   //
    4256   new JLabel(tr("Label always in tr()"));
     
    5569   '''DO'''
    5670   {{{new JLabel(tr("My Label {0}",labelId));}}}
    57    
     71
    5872   Only exception: {{{+}}} can be used to break long lines of non-variable texts.
    5973
    6074 * When using apostrophe, the following rules apply:
    61    
     75
    6276   For all {{{tr}}} the apostrophe is special. (Like backslash in C)[[BR]]
    6377   It needs to be escaped by another apostrophe: