This document outlines coding standards for use at Open Knowledge Foundation. It is a living document, and we encourage pull request and issues to improve on or contest ideas as expressed.
README.md
file with examples of how to use the code.README.md
files for brevity and accessibility of documentation.eslint
; Lint Python using pylint
.Our work is done in Python and Javascript (Node.js). There can be good reasons for writing a particular library or app in another language, but if you think this is the case, please raise this issue directly before starting any work.
For example apps that implement the OKF preferences, see the following:
pylint
to lint code.The critical points are:
lower_case_with_underscores
TitleCase
And other preferences:
self
) or if it would be better as a utility function@classmethod
, consider if it really needs the class (needs cls
) or it would be better as a utility function or factory classAs a rule, all Python code should be written to support Python 2 and Python 3. There are some circumstances where, for new apps, we may want to write specifically for the Python 3 interpreter in order to take advantage of great new language features like asyncio
, but at this stage, this is likely an exception and not the rule. No code should be written to be compatible with Python 2 only.
The python porting guide has great, practical advice on writing code for Python 2 and 3. Some choose to use helper libraries like six
. In any case, it is strongly recommend to follow the advice from the Python porting guide and add the following snippet to all Python modules to ensure API consistency for strings, division, imports, and the print function.
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
eslint
to lint code.ES6
and compile/transpile with Webpack or Browserify. This applies to frontend and backend code. In some cases, the cost of transpilation (inflated file size) is too great (for small utility libraries), so use judgement.The critical points are:
camelCase
TitleCase
And other preferences:
ES6
or any code that you are transpiling - it is quite unnecessary.tox
with py.test
to test code.mocha
to test code.Zombie.js
or jsdom
for tests that require a DOM.Use Sphinx-style or Google-style documentation conventions.
Prefer to make really good README.md
files, rather than implementing a full documentation framework.
Use Google-style documentation conventions.
Prefer to make really good README.md
files, rather than implementing a full documentation framework.
We prefer the following frameworks and libraries. If you want to use an *alternative to one of these please flag this before starting any work.
We use Git for all projects.
We generally follow Git Flow, with some modifications, and some flexibility per project. The following should hold true for pretty much all projects:
master
branchmaster
feature/{}
or a fix/{}
branch that is checked out from master
#{issue_id}
, and the various other related conventions used by most Git hosts.All projects must be configured with a CI server. We use Travis CI by default. The CI server must run the test suite with linting.
All apps must be deployed from the CI server.
All packages must be published to npm and pypi from the CI server. The procedure is:
okfn
user owner rights on the package.We support modern browsers. Notably, IE 10 and above. Our browser support is in sync with the browser support of Google web properties, as declared here
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4