From 682657dfd22cfc97e0c6cca0566bec7f9597934b Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Feb 12 2020 10:12:38 +0000 Subject: Describe coding standards and practices for this project Fixes #1242 I am intentionally not adding every possible convention. There is no reason to tighten the reins more than necessary. This document should help us achieve more readable code, not annoy us with unnecessary rules. --- diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md new file mode 100644 index 0000000..62f2ec2 --- /dev/null +++ b/CONTRIBUTE.md @@ -0,0 +1,44 @@ +# CONTRIBUTE.md + +This document describes coding standards and practices that Copr developers +agreed to comply with. In a case of controversy, the following rules take +precedence over one's personal preference. + + +## PEP8 + +All new code must be [PEP8][pep8] compliant. Occasional exceptions to this rule +are allowed only when: + +1. The violation is uniformly approved +2. The code contains a comment to disable Pylint warning, + e.g. ` # pylint: disable=W0703` + + +## Docstrings + +Although PEP8 permits multiple styles of writing docstrings, the standard for +this project is using triple-quotes, e.g. + + """ + This is an example docstring + having more than just one line + """ + +The triple-quote style must be used even for one-line docstrings, e.g. + + """Return the pathname of the KOS root directory.""" + + +## Primary keys + +Every database table must have an autoincrement integer primary key named `id`. +This applies also in cases when the ID value is not used. + +A presence of primary key is a requirement for data to comply with the First +normal form. Having numeric primary keys is a convention agreed among team +members. + + + +[pep8]: https://www.python.org/dev/peps/pep-0008/