Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
Frederic Pillon edited this pageMar 6, 2023 ·5 revisions

Astyle

AStyle is used for coding style checking.

Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C++/CLI, Objective‑C, C# and Java programming languages.

GitHub action is used to ensure each PR (Pull Request) andmain branch of theSTM32 core follow the code style definition defined.

Only sources files (*.h,*.hpp,*.c,*.cpp) from the followingSTM32 core directory lists are checked:

  • cores/
  • libraries/
  • variants/

Ignored files

.astyleignore file contains list of folder to ignore.

Code style definition

Hereafter the code style definition applied (.astylerc)

# STM32duino code style definition file for Astyle# Don't create backup files, let git handle itsuffix=none# K&R stylestyle=kr# 1 TBS addition to k&r, add braces to one liners# Use -j as it was changed in astyle from brackets to braces, this way it is compatible with older astyle versions-j# 2 spaces, convert tabs to spacesindent=spaces=2convert-tabs# Indent switches and casesindent-classesindent-switchesindent-casesindent-col1-comments# Remove spaces in and around parenthesesunpad-paren# Insert a space after if, while, for, and around operatorspad-headerpad-oper# Pointer/reference operators go next to the name (on the right)align-pointer=namealign-reference=name# Attach { for classes and namespacesattach-namespacesattach-classes# Extend longer lines, define maximum 120 value. This results in aligned code,# otherwise the lines are broken and not consistentmax-continuation-indent=120# if you like one-liners, keep themkeep-one-line-statements

Python script

Python scriptastyle.py is provided to ease use ofAStyle:

usage: astyle.py [-h] [-d <code style definition file>] [-g | -b <branch name>] [-i <ignore file>] [-p <astyle install path>]                 [-r <source root path>]Launch astyle on source files.options:  -h, --help            show this help message and exit  -d <code style definition file>, --definition <code style definition file>                        Code style definition file for Astyle. Default: <repo path>/Arduino_Core_STM32/CI/astyle/.astylerc  -g, --gitdiff         Use changes files from git default branch. Default: {git_branch}  -b <branch name>, --branch <branch name>                        Use changes files from git specified branch.  -i <ignore file>, --ignore <ignore file>                        File containing path to ignore. Default: <repo path>/Arduino_Core_STM32/CI/astyle/.astyleignore  -p <astyle install path>, --path <astyle install path>                        Astyle installation path  -r <source root path>, --root <source root path>                        Source root path to use. Default: <repo path>/Arduino_Core_STM32

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp