- Table of contents
- Open Source
- Clean code draft
OpenAtlas is developed with some standards in mind.
Only open source libraries (e.g. jQuery) and open source software requirements (e.g. a PostgreSQL database) are used.
All non-code files (e.g. logo) should be open too (CC BY-SA 4.0).
This guaranties that the application can be shared as open source (GPL 2) e.g. on GitHub.
- Check the license for compatibility
- Store them in openatlas/static/vendor
- Add a license file if available
Python code should be covered by tests with assertions. We aim for 100% code coverage although some parts (e.g. mail functions) may be excluded with the # pragma: no cover option.
Mypy is an optional static type checker for Python that aims to combine the benefits of dynamic (or "duck") typing and static typing. Available as plugin for PyCharm where we use it with
--ignore-missing-imports --allow-untyped-decorators --no-warn-return-any --strict
We are using PEP 8 Style Guide for Python Code with the exception of allowing a line length of 100 characters. Available as plugin for PyCharm.
In evaluation¶These tools look interesting and we will take a closer a look at some point.
- Pylint, available Debian package and PyCharm plugin
- tabnanny run python -m tabnanny . in the root of your project
- coala, sadly no Debian package or PyCharm plugin seems to be available (2020)
We are using HTML 5 and the site should be validating correctly.
Exceptions may be acceptable if (harmless) non valid HTML 5 is produced by 3rd party libraries.
Of course we do our best to avoid them in the first place but if bugs in already released versions get apparent they always have the highest priority.
Clean code draft¶
- Every comment is a failure to not write otherwise readable code
- No todo comments (in between for one self is ok but not in shared code)
- 30 - 100 lines
- max 20 lines
- max 3 arguments
- max 2 indents
- no boolean parameters?
- no switch statements
- if: only one line after (use function call)
- try-catch: no code before and after, only one line inside (use function call)