Blame HACKING

Packit 4b6dd7
Formatting
Packit 4b6dd7
==========
Packit 4b6dd7
Packit 4b6dd7
All code should follow the same formatting standards which are broadly based on the GNU style (http://www.gnu.org/prep/standards.html) with some
Packit 4b6dd7
additions. Briefly:
Packit 4b6dd7
Packit 4b6dd7
 - Tab indents are used and braces for blocks go on the same line as the block statement:
Packit 4b6dd7
Packit 4b6dd7
	if (x < foo (y, z)) {
Packit 4b6dd7
		haha = bar[4] + 5;
Packit 4b6dd7
	} else {
Packit 4b6dd7
		while (z) {
Packit 4b6dd7
			haha += foo (z, z);
Packit 4b6dd7
			z--;
Packit 4b6dd7
		}
Packit 4b6dd7
		return abc (haha);
Packit 4b6dd7
	}
Packit 4b6dd7
Packit 4b6dd7
   Braces should be omitted for single-line blocks, but included for all blocks in a multi-part if statement which has blocks containing more than
Packit 4b6dd7
   one line (as above).
Packit 4b6dd7
Packit 4b6dd7
 - Spaces should be present between function name and argument block, and after commas:
Packit 4b6dd7
Packit 4b6dd7
	foo (z, z)
Packit 4b6dd7
Packit 4b6dd7
 - In pointer types, the '*' is grouped with the variable name, not with the base type. 
Packit 4b6dd7
Packit 4b6dd7
	int *a;
Packit 4b6dd7
Packit 4b6dd7
   Not:
Packit 4b6dd7
Packit 4b6dd7
	int* a;
Packit 4b6dd7
Packit 4b6dd7
   In cases where there is no variable name, for instance, return values, there should be a single space between the base type and the '*'.
Packit 4b6dd7
Packit 4b6dd7
   Type casts should have no space between the type and '*', but a space before the variable being cast:
Packit 4b6dd7
Packit 4b6dd7
	(gchar*) foobar;
Packit 4b6dd7
	(gchar**) &foobar;
Packit 4b6dd7
Packit 4b6dd7
 - Function and variable names are lower_case_with_underscores, type names are CamelCase and macro names are UPPER_CASE_WITH_UNDERSCORES.
Packit 4b6dd7
Packit 4b6dd7
 - Comparisons to NULL, TRUE and FALSE should always be made explicit, for clarity.
Packit 4b6dd7
Packit 4b6dd7
 - Code should be wrapped at the 150th column, such that it doesn't require horizontal scrolling on a decent-sized display.
Packit 4b6dd7
   Don't wrap at the 80th column.
Packit 4b6dd7
Packit 4b6dd7
Documentation comments
Packit 4b6dd7
======================
Packit 4b6dd7
Packit 4b6dd7
All public API functions should have inline documentation headers in the gtk-doc style. For more information about gtk-doc comments, see the gtk-doc
Packit 4b6dd7
manual (http://library.gnome.org/devel/gtk-doc-manual/stable/). There are a few conventions above and beyond the standard gtk-doc formatting which
Packit 4b6dd7
libgdata employs:
Packit 4b6dd7
Packit 4b6dd7
 - For API which returns allocated memory, the relevant free/unref function must be mentioned in the "Return value" part of the documentation:
Packit 4b6dd7
Packit 4b6dd7
	* Return value: a new #GDataEntry; unref with g_object_unref()
Packit 4b6dd7
Packit 4b6dd7
   If the function can also return NULL (on error, for example) or some other "default" value (-1, 0, etc.), format it as follows:
Packit 4b6dd7
Packit 4b6dd7
	* Return value: a new #GDataGDFeedLink, or %NULL; free with gdata_gd_feed_link_free()
Packit 4b6dd7
Packit 4b6dd7
   Note that if a function returns NULL as a result of a precondition or assertion failure, this should not be listed in the documentation. The
Packit 4b6dd7
   precondition itself may be listed in the function documentation prose, but if it's the only reason for a function to return NULL, the "or %NULL"
Packit 4b6dd7
   clause should be omitted.
Packit 4b6dd7
Packit 4b6dd7
 - When adding API, make sure to add a "Since" clause:
Packit 4b6dd7
Packit 4b6dd7
	* Since: 0.2.0
Packit 4b6dd7
Packit 4b6dd7
 - For object methods, the "self" parameter should be documented simply as "a #GObjectType":
Packit 4b6dd7
Packit 4b6dd7
	* @self: a #GDataQuery
Packit 4b6dd7
Packit 4b6dd7
 - For function parameters which can legitimately be set to NULL (or some other default value), list that as follows:
Packit 4b6dd7
Packit 4b6dd7
	* @updated_max: the new maximum update time, or %NULL
Packit 4b6dd7
Packit 4b6dd7
 - If numbers, such as -1, are mentioned in documentation as values to be passed around in code, they should be wrapped in a DocBook "code" tag
Packit 4b6dd7
   (e.g. "-1"), so that they appear similarly to NULL in the documentation.
Packit 4b6dd7
Packit 4b6dd7
 - The documentation explaining the purpose of a property, its limitations, interpretation, etc., should be given in the gtk-doc comment for the
Packit 4b6dd7
   GObject property itself, not in the documentation for its getter or setter. The documentation for the getter and setter should be stubs which
Packit 4b6dd7
   refer to the property's documentation. The getter and setter documentation should, however, still include full details about whether NULL values
Packit 4b6dd7
   are permissible for the function parameters, or are possible as the return value, for example.
Packit 4b6dd7
Packit 4b6dd7
Adding public API
Packit 4b6dd7
=================
Packit 4b6dd7
Packit 4b6dd7
 - Ensure it has proper guards against bad parameters:
Packit 4b6dd7
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_QUERY (self));
Packit 4b6dd7
	g_return_if_fail (foobar != NULL);
Packit 4b6dd7
Packit 4b6dd7
 - All public API must have a gtk-doc comment, and be added to the docs/reference/gdata-sections.txt file, to include it in the documentation.
Packit 4b6dd7
   The documentation comment must have a "Since" clause (see "Documentation comments" section).
Packit 4b6dd7
Packit 4b6dd7
 - All public API must be listed in gdata/gdata-*.symbols.
Packit 4b6dd7
Packit 4b6dd7
 - Non-trivial API should have a test case added in the relevant test suite file in gdata/tests. Note that the "general" test suite file cannot make
Packit 4b6dd7
   network requests in the course of running its test cases.
Packit 4b6dd7
Packit 4b6dd7
 - All GObject properties must have getter/setter functions.
Packit 4b6dd7
Packit 4b6dd7
 - All API which returns allocated memory must be tagged with G_GNUC_WARN_UNUSED_RESULT after its declaration, to safeguard against consumers of the
Packit 4b6dd7
   API forgetting to use (and consequently free) the memory. This is unlikely, but adding the macro costs little and acts as a reminder in the API
Packit 4b6dd7
   documentation to free the result.
Packit 4b6dd7
Packit 4b6dd7
 - All GObject *_get_type function declarations must be tagged with the G_GNUC_CONST macro, as well as any other applicable functions
Packit 4b6dd7
   (see the gcc documentation: http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g_t_0040code_007bconst_007d-function-attribute-2207).
Packit 4b6dd7
Packit 4b6dd7
 - All properties which could be considered to use an enumerated value should almost definitely use a string instead. See the documentation section
Packit 4b6dd7
   on "Enumerable Properties" in the "GData Overview" section. Where appropriate, the values for these string properties should be made available
Packit 4b6dd7
   as #defines.
Packit 4b6dd7
Packit 4b6dd7
 - New services should be implemented in libgdata itself, not by applications which use libgdata. See the documentation section on "New Services" in
Packit 4b6dd7
   the "GData Overview" section.
Packit 4b6dd7
Packit 4b6dd7
 - New API must never be added in a stable micro release. API additions can only be made in a major or minor release; this is to prevent the LT version
Packit 4b6dd7
   of one minor version's micro releases exceeding the LT version of the next minor version as almost happened between versions 0.6.3 and 0.7.0.
Packit 4b6dd7
   See http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html for information about libtool's versioning system. See also the
Packit 4b6dd7
   “Versioning” section below.
Packit 4b6dd7
Packit 4b6dd7
 - Any async function which uses non-async-scope callbacks as well as the async ready callback should provide GDestroyNotify callbacks for destroying
Packit 4b6dd7
   the user data for those callbacks. See https://bugzilla.gnome.org/show_bug.cgi?id=649728 for details.
Packit 4b6dd7
Packit 4b6dd7
 - Any new class’ class structure (e.g. GDataServiceClass) must have reserved slots to allow future API additions of virtual functions without
Packit 4b6dd7
   breaking ABI.
Packit 4b6dd7
Packit 4b6dd7
Choosing function names
Packit 4b6dd7
=======================
Packit 4b6dd7
Packit 4b6dd7
In general, use common sense. However, there are some specific cases where a standard is enforced:
Packit 4b6dd7
Packit 4b6dd7
 - For boolean getters (e.g. for FooBar:is-baz) use foo_bar_is_baz, rather than foo_bar_get_is_baz. Note that the property name should be "is-baz",
Packit 4b6dd7
   rather than just "baz".
Packit 4b6dd7
Packit 4b6dd7
 - For boolean setters use foo_bar_set_is_baz, rather than foo_bar_set_baz.
Packit 4b6dd7
Packit 4b6dd7
 - In general, try to keep API named similarly to the actual GData API constructs. In certain cases, however, it might make more sense to rename pieces
Packit 4b6dd7
   of API to be less cryptic (e.g. "timezone" instead of "ctz").
Packit 4b6dd7
Packit 4b6dd7
Deprecating public API
Packit 4b6dd7
======================
Packit 4b6dd7
Packit 4b6dd7
As libgdata moves towards API stability, old API should be deprecated rather than broken or removed entirely. The following should be ensured when
Packit 4b6dd7
deprecating API:
Packit 4b6dd7
Packit 4b6dd7
 - G_GNUC_DEPRECATED_FOR is added to the API in the public header file.
Packit 4b6dd7
Packit 4b6dd7
 - A “Deprecated:” line is added to the gtk-doc comment for the API. This should mention what API replaces it, give a brief explanation of why the
Packit 4b6dd7
   API has been deprecated, and finish with “(Since: [version].)” to list the version the API was deprecated.
Packit 4b6dd7
Packit 4b6dd7
 - “#ifndef LIBGDATA_DISABLE_DEPRECATED” should be wrapped around the API in the public header file.
Packit 4b6dd7
Packit 4b6dd7
 - All references to the API/uses of the API in libgdata code (including demos and the test suite) should be ported to use the replacement API instead.
Packit 4b6dd7
   If this isn't possible, the deprecated function should be split into a static function which contains all the code, and the public symbol should
Packit 4b6dd7
   become a simple wrapper of this static function. This allows the static function to be used inside libgdata without causing deprecation warnings.
Packit 4b6dd7
Packit 4b6dd7
 - Don't remove deprecated symbols from gdata-*.symbols.
Packit 4b6dd7
Packit 4b6dd7
 - Don't forget to also deprecate related symbols, such as the getter/setter for a property (or vice-versa).
Packit 4b6dd7
Packit 4b6dd7
Commit messages
Packit 4b6dd7
===============
Packit 4b6dd7
Packit 4b6dd7
libgdata does not use a ChangeLog; it is auto-generated from the git log when packaging a release. Commit messages should follow the GNOME commit
Packit 4b6dd7
message guidelines (https://wiki.gnome.org/Git/CommitMessages), with the exception that when a commit closes a bug, the short explanation of the commit
Packit 4b6dd7
should simply be the bug's title, as copied from Bugzilla (e.g. "Bug 579885 – Add code examples to documentation"). The long explanation should then
Packit 4b6dd7
be used to give details of the changes. If the bug's title is not relevant, it should be changed before committing the changes.
Packit 4b6dd7
Packit 4b6dd7
Unless the short explanation of a commit is a bug title, it should always be prefixed by a tag to describe the part of the library it touches, using
Packit 4b6dd7
the following format "tag: Short explanation". The following tags are valid:
Packit 4b6dd7
Packit 4b6dd7
 - core: for the core code in the gdata directory, such as GDataEntry.
Packit 4b6dd7
Packit 4b6dd7
 - atom: for the Atom-namespaced code in the gdata/atom directory.
Packit 4b6dd7
Packit 4b6dd7
 - gcontact: for the gContact-namespaced code in the gdata/gcontact directory.
Packit 4b6dd7
Packit 4b6dd7
 - gd: for the GData-namespaced code in the gdata/gd directory.
Packit 4b6dd7
Packit 4b6dd7
 - media: for the Media RSS-namespaced code in the gdata/media directory.
Packit 4b6dd7
Packit 4b6dd7
 - build: for build changes and releases.
Packit 4b6dd7
Packit 4b6dd7
 - docs: for documentation changes which are not specific to a service, such as updates to the docs directory, NEWS, README, this file, etc.
Packit 4b6dd7
Packit 4b6dd7
 - tests: for changes to the test code in gdata/tests which are not specific to a service or namespace.
Packit 4b6dd7
Packit 4b6dd7
 - demos: for changes to the demo applications in the demos directory.
Packit 4b6dd7
Packit 4b6dd7
 - introspection: for introspection annotations and build changes.
Packit 4b6dd7
Packit 4b6dd7
 - calendar: for the Google Calendar code in gdata/services/calendar.
Packit 4b6dd7
Packit 4b6dd7
 - contacts: for the Google Contacts code in gdata/services/contacts.
Packit 4b6dd7
Packit 4b6dd7
 - documents: for the Google Documents code in gdata/services/documents.
Packit 4b6dd7
Packit 4b6dd7
 - picasaweb: for the PicasaWeb code in gdata/services/picasaweb.
Packit 4b6dd7
Packit 4b6dd7
 - youtube: for the YouTube code in gdata/services/youtube.
Packit 4b6dd7
Packit 4b6dd7
The only commits which should not have a tag are translation commits, touching only the po directory.
Packit 4b6dd7
Packit 4b6dd7
Versioning
Packit 4b6dd7
==========
Packit 4b6dd7
Packit 4b6dd7
Starting with version 0.9.0, libgdata has adopted an even–odd/stable–unstable versioning policy, where odd minor version numbers are unstable releases,
Packit 4b6dd7
released periodically (with increasing micro version numbers) and leading to a stable release with the next even minor version number. API breaks of
Packit 4b6dd7
new API are allowed in micro releases with an odd minor version number, but not in micro releases with an even minor version number.
Packit 4b6dd7
Packit 4b6dd7
ABI and API backwards compatibility must be preserved unless the major version number is changed. libgdata is now ABI-stable.
Packit 4b6dd7
Packit 4b6dd7
It is encouraged to make a new micro release of an odd minor series after each large API addition or break.