Skip to content

AStyle update (use options and ignore file for astyle) #400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions docs/reference/contributing/guidelines/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ Whether you're writing new code or fixing bugs in existing code, please follow t

Mbed OS follows the [K&R style](https://en.wikipedia.org/wiki/Indent_style#K.26R_style), with at least two exceptions (which can be found in the list below the code sample).

The only exception to this coding style involves third-party code. Third-party code should be added to the `.astyleignore` file located in the Mbed OS root directory.

You can use [Artistic Style (AStyle)](http://sourceforge.net/projects/astyle/files/) to format your code. Use the command-line switch to select the correct style and point to the file you want to edit:

```
astyle -n --options=.astylerc $(full_path_to_file)
```

File `.astylerc` defines Mbed OS code style and it's located in Mbed OS root directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One possible addition here - "Reformat a code should be in a commit with no other changes."

##### Code sample

```c
Expand Down Expand Up @@ -156,12 +166,6 @@ typedef struct analogin_s analogin_t;

All functions and methods should contain documentation using Doxgyen.

You can use [Artistic Style (AStyle)](http://sourceforge.net/projects/astyle/files/) to format your code. Use the command-line switch to select the correct style and point to the file you want to edit:

```
astyle.exe --style=kr --indent=spaces=4 --indents-switches $(full_path_to_file)
```

#### Compiler settings

All C and C++ code submitted to Mbed OS must compile with GCC Arm Embedded, Arm Compiler 5 and IAR EWARM. Mbed OS:
Expand Down