This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devel:source_file_headers [2008/10/16 12:57] jodal syntax |
devel:source_file_headers [2009/09/24 11:55] (current) morten deprecate this page |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | :!: Python boilerplates have been implemented as described in the [[hacking#python_boilerplate_headers|HACKING]] document. Boilerplates for other languages have not been provided, but should be similar in style to the Python ones. | ||
+ | |||
+ | :!: This page is now only here for historic purposes. | ||
+ | |||
====== Source file headers ====== | ====== Source file headers ====== | ||
Line 115: | Line 119: | ||
* **Variables:** Readable to a human, just like the comments, but also easily extracted programatically. Only the ''%%__version__%%'' variable is mentioned in [[http://www.python.org/dev/peps/pep-0008/ | PEP 8]]. May be preferable to comments, but we do not extract them in any way, so lets just keep to the dead simple comments. | * **Variables:** Readable to a human, just like the comments, but also easily extracted programatically. Only the ''%%__version__%%'' variable is mentioned in [[http://www.python.org/dev/peps/pep-0008/ | PEP 8]]. May be preferable to comments, but we do not extract them in any way, so lets just keep to the dead simple comments. | ||
- | ===== Proposed Python header ===== | + | ===== Proposed headers ===== |
+ | |||
+ | ==== Python ==== | ||
<code python> | <code python> | ||
Line 130: | Line 136: | ||
The first line may be dropped in non-executables. The second line is in conformance with [[http://www.python.org/dev/peps/pep-0263/ | PEP 0263]] and should also be recognized by i.e. Emacs and VIM. The docstring marks the start of the code, now at line 4 instead of 20. I.e. the copyright which must be kept up to date is now mentally a part of the code. | The first line may be dropped in non-executables. The second line is in conformance with [[http://www.python.org/dev/peps/pep-0263/ | PEP 0263]] and should also be recognized by i.e. Emacs and VIM. The docstring marks the start of the code, now at line 4 instead of 20. I.e. the copyright which must be kept up to date is now mentally a part of the code. | ||
- | ===== Proposed Cheetah header ===== | + | ==== Cheetah ==== |
<code cheetah> | <code cheetah> | ||
Line 142: | Line 148: | ||
</code> | </code> | ||
- | ===== Proposed Django template header ===== | + | ==== Django templates ==== |
- | No header. We do not currently have any headers in the Django templates. It may be added using multiple ''{## comment here ##}'' tags if we really need it. The comment tags may not be wrapped over multiple lines. | + | We do not currently have any headers in the Django templates. |
- | ===== Proposed Java header ===== | + | <code html> |
+ | {% comment %} | ||
+ | A line describing this template. | ||
+ | |||
+ | Copyright (C) 2002-2004 Norwegian University of Science and Technology | ||
+ | Copyright (C) 2007-2008 UNINETT AS | ||
+ | Released under the terms of the GNU General Public License version 2. | ||
+ | {% endcomment %} | ||
+ | </code> | ||
+ | |||
+ | ==== Java ==== | ||
<code java> | <code java> | ||
Line 157: | Line 173: | ||
*/ | */ | ||
</code> | </code> | ||
+ | |||
+ | ===== Migration plan ===== | ||
+ | |||
+ | How do we get rid of this mess? | ||
+ | |||
+ | - Cleanup the header of all files you edit. Remember the Boy Scout Rule: Leave the camp ground cleaner than you found it. | ||
+ | - If you have nothing else to do: Cleanup larger groups of files, i.e. entire subsystems. | ||
+ |