Skip to content

Code Style guidelines

Antoniu Miclăuş edited this page Dec 22, 2021 · 2 revisions

To apply style guidelines, astyle is used.

For the source code in the No-OS repository, the following configuration should be used: astyle_config:

--style=linux
--indent=force-tab=8
--max-code-length=80
--suffix=none

Run manually:

To use it, copy the script above to a file named e.g. 'astyle_config'. Then, to apply the style to the source file example.cpp, call 'astyle' with the following command: astyle --options=astyle_config example.cpp

The file example.cpp will be rewritten to match the style rules.

Run from script(Linux):

A shell script that automates the code style check is available at: https://github.com/analogdevicesinc/no-OS/blob/master/ci/astyle.sh

Run the script from the root of the repository, for example:

./ci/astyle.sh

All the changed files in the last commit from the current branch will be checked and rewritten. The differences will be displayed after code style is applied.

Run script with parameter:

Optionally, the commit range can be passed as parameter to the script, applying code style on all changed files within the commits.

./ci/astyle.sh <COMMIT_RANGE>

Clone this wiki locally