234 | | 18. Make sure a new line is at the end of each file and UNIX style newlines are used (`\n`). |
235 | | |
236 | | |
237 | | 19. When writing Makefiles, use the current standard. |
238 | | |
239 | | If you have to use commands, please check for: |
240 | | {{{ |
241 | | avoid | use instead |
242 | | ------------------+--------------- |
243 | | make target | $(MAKE) target |
244 | | mkdir target | $(MKDIR) target |
245 | | cp (executable) | $(INSTALL) -m 755 file target |
246 | | cp (normal file) | $(INSTALL) -m 644 file target |
247 | | ar | $(AR) |
248 | | }}} |
249 | | `rm`: be VERY careful with recursive remove. Also beware of |
250 | | removing $(FOO)* if $(FOO) has any chance of being empty. |
251 | | |
252 | | Examples: see below examples or others[[BR]] |
253 | | source:grass/trunk/raster/r.info/Makefile [[BR]] |
254 | | source:grass/trunk/vector/v.edit/Makefile |
255 | | |
256 | | If you are unsure, please ask on the GRASS Developers list. |
257 | | |
258 | | |
259 | | 20. Have a look at source:grass/trunk/INSTALL |
260 | | |
261 | | |
274 | | 24. For consistency, use `README` rather than `README.txt` for any `README` files. |
275 | | |
276 | | |
277 | | 25. GRASS/Environment variables: |
278 | | If you add a new variable, please follow the naming convention. All variables are described in source:grass/trunk/lib/init/variables.html |
279 | | |
280 | | |
281 | | 26. Be sure to develop on top of the LATEST GRASS code (which is in our SVN repository). You can re-check before submission with `svn diff`: |
282 | | |
283 | | Be sure to create unified (`diff -u`) format. "Plain" diffs (the default format) are risky, because they will apply without warning to code which has been substantially changed; they are also harder to read than unified. |
284 | | |
285 | | Such diffs should be made from the top-level directory, e.g. `svn diff display/d.vect/main.c`; that way, the diff will include the pathname rather than just an ambiguous `main.c`. |
286 | | |
287 | | |
288 | | 27. Try to use module names which describe shortly the intended purpose of the module. |
289 | | |
290 | | The first letters for module name should be: |
291 | | {{{ |
292 | | d. - display commands |
293 | | db. - database commands |
294 | | g. - general GIS management commands |
295 | | i. - imagery commands |
296 | | m. - miscellaneous tool commands |
297 | | ps. - postscript commands |
298 | | r. - raster commands |
299 | | r3. - raster3D commands |
300 | | v. - vector commands |
301 | | }}} |
302 | | Some additional naming conventions |
303 | | * export modules: (type).out.(format) eg: `r.out.arc`, `v.out.ascii` |
304 | | * import module: (type).in.(format) eg: `r.in.arc`, `v.in.ascii` |
305 | | * conversion modules: (type).to.(type) eg: `r.to.vect`, `v.to.rast`, `r3.to.rast` |
306 | | |
307 | | Avoid module names with more than two dots in the name. |
308 | | Example: instead of `r.to.rast3.elev` use `r.to.rast3elev` |
309 | | |
310 | | |
311 | | 28. Use the grass test suite to test your modules. |
312 | | |
313 | | http://www-pool.math.tu-berlin.de/~soeren/grass/GRASS_TestSuite |
314 | | |
315 | | You can easily write specific tests for your modules. |
316 | | |
317 | | If your module is part of GRASS and you created some standard test cases, please contact the developers to add your tests to the default test suite. This will automatize complex test scenarios and assure to find bugs much faster, if changes were made to your modules or to the grass library. |
318 | | |
319 | | Consider to subscribe to the GRASS Quality Assessment System to get immediate notification about the code quality: |
320 | | |
321 | | http://lists.osgeo.org/mailman/listinfo/grass-qa |
322 | | |
323 | | |
324 | | 29. When submitting new files to the repository set SVN properties, |
325 | | usually for directory |
326 | | {{{ |
327 | | svn:ignore : *.tmp.html |
328 | | *OBJ* |
329 | | }}} |
330 | | or e.g. for C-file |
331 | | {{{ |
332 | | svn:mime-type : text/x-csrc |
333 | | svn:keywords : Author Date Id |
334 | | svn:eol-style : native |
335 | | }}} |
336 | | See |
337 | | http://svnbook.red-bean.com/en/1.4/svn.advanced.props.html |
338 | | |
339 | | To set a property: |
340 | | {{{ |
341 | | svn propset svn:keywords 'Author Date Id' <file> |
342 | | svn propset svn:mime-type text/x-sh grass_shellscript.sh |
343 | | }}} |
344 | | To edit the `svn:ignore` property using your default text editor: |
345 | | {{{ |
346 | | svn propedit svn:ignore <directory> |
347 | | }}} |
348 | | To set the `svn:ignore` property non-interactively, first create a file containing the value: |
349 | | {{{ |
350 | | echo "*.tmp.html" > ignore.txt |
351 | | echo "*OBJ*" >> ignore.txt |
352 | | }}} |
353 | | then use: |
354 | | {{{ |
355 | | svn propset -F ignore.txt svn:ignore <directory> |
356 | | }}} |
357 | | List of mime-type: |
358 | | {{{ |
359 | | C++ files (.cpp): text/x-c++src |
360 | | C files (.c): text/x-csrc |
361 | | DTD files (.dtd): text/xml-dtd |
362 | | GIF files (.gif): image/gif |
363 | | Header files (.h): text/x-chdr |
364 | | HTML files (.html): text/html |
365 | | JPEG files (.jpg): image/jpeg |
366 | | Makefiles: text/x-makefile |
367 | | PNG files (.png): image/png |
368 | | Python files (.py): text/x-python |
369 | | Shell scripts (.sh): text/x-sh |
370 | | Text files (.txt): text/plain |
371 | | XML files (.xml): text/xml |
372 | | }}} |
373 | | (please update the list...) |
374 | | |
375 | | For your convenience use the source:grass-addons/tools/module_svn_propset.sh script. |