Like any other project we have some small guidelines about our source
code, too. The rules we have are not there to punish you - the rules are
in place to help us all. By having a consistent coding style it becomes
very easy for new and also longtime contributors to navigate through the
sources and all the implied logic of any one source file..
Python 3 **shall** be used. How long can we keep Python 2 alive anyway?
No considerations for Python 2 compatibility **should** be taken at any
- Python: Tabs **shall not** be used. Every indentation level should
be 4 spaces
- XML: Tabs **shall not** be used. Every indentation level should be 2
There are extensions to e.g. VIM (xmllint) which will help you to get
your indention levels correct. Add to following to your .vimrc file:
`au FileType xml setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null`
now you can call the linter using `gg=G` in command mode.
### Text generation
Template processor **should** be used for generating config files.
Built-in string formatting **may** be used for simple line-oriented
formats where every line is self-contained, such as iptables rules.
Template processor **must** be used for structured, multi-line formats
such as those used by ISC DHCPd.
The default template processor for VyOS code is [Jinja2]().
When modifying the source code, remember these rules of the legacy
- No new features in Perl
- No old style command definitions
- No code incompatible with Python3