X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=HACKING;h=9f2f14392d45779bd7a18f8e18077572ec23e521;hp=a4698a62719290dc238e657d9dafc176ff195b95;hb=HEAD;hpb=2b46b01c72c06683b3130647affe92c425d573b5 diff --git a/HACKING b/HACKING index a4698a6..9f2f143 100644 --- a/HACKING +++ b/HACKING @@ -17,6 +17,12 @@ the Python PEP-8, which includes the convention of 4 spaces for indentation: http://www.python.org/dev/peps/pep-0008/ +Exceptions: + + - All strings should use single quotes ('foo' instead of "foo"). + + - No double-newlines between methods (or anywhere else). + Contributions ------------- @@ -141,9 +147,22 @@ Protocol decoder guidelines - Longer, multi-line descriptions should be placed in the protocol decoder's __init__.py file as docstring. It can be viewed (for a specific - protocol decoder, e.g., UART) via "sigrok-cli -a uart", or in various + protocol decoder, e.g., UART) via "sigrok-cli -P uart --show", or in various other places in GUIs. + - Input IDs, output IDs, tags, channel IDs, option IDs, annotation class IDs, + annotation row IDs, and binary class IDs each must be unique. + + - Annotation class IDs must not overlap with annotation row IDs. + For example, you cannot have an annotation row named "foo" if you already + have an annotation class named "foo". This avoids confusion for users + and simplifies e.g. command-line usage of decoders. + + - Annotation class IDs should generally be singular, annotation row IDs + should generally be plural. Example: UART annotation classes could be + named "stop-bit" or "parity-bit" (singular), the annotation row containing + these annotation classes could be named "bits" (plural). + - Generally use strings for states (of the PD state machine), not integers. This avoids having to keep a list of state definitions at the top of file. The performance overhead for this is negligible in practice.