wiki:MessageStandardization

Version 2 (modified by martinl, 15 years ago) ( diff )

how to format

In progress, see http://grass.osgeo.org/wiki/Development_Specs

Message Standardization

How should Errors/Warnings/Messages be formatted

  • Only user derived variables should be bracketed, not GRASS derived variables. for example:
     Yes: Creating raster map <%s>.  Pass 1 of 7 ...
     No:  Creating <raster> map <%s>.  Pass [1] of [7] ...
    
  • strings &lt; &gt; e.g. Raster map <%s> not found
  • numbers [ ] e.g. Line [%d] deleted

: ? The [bracketed] parenthetical disrupts the flow of the phrase and doesn't help enhance clarity of meaning. IMHO, this reads better without [] brackets: "Line %d deleted." [] Brackets should be used when value is outside of the phrase: "Unknown line [%d]". --HB

Discussion:

Statistics [2007-04-11]:

symbol number of code lines (2007-04-11) 2008-02-14 (6.3svn)
<%s> 637 1406
[%s] 690 427
'%s' 354 370
<%d> 12 7
[%d] 207 13
'%d' 3 1
TYPES="<%s> \[%s\] '%s' <%d> \[%d\] '%d'"

for TYPE in $TYPES ; do
  NUM_HITS=`grep -rI "$TYPE" * | grep -v '/.svn/\|^dist.i686-\|locale/po/' | wc -l`
  echo "$TYPE  $NUM_HITS"
done
Note: See TracWiki for help on using the wiki.