You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "szymon-czapracki (via GitHub)" <gi...@apache.org> on 2026/10/09 10:41:57 UTC
[PR] Introduction of new custom code formatting tool [mynewt-nimble]
szymon-czapracki opened a new pull request, #2319:
URL: https://github.com/apache/mynewt-nimble/pull/2319
## Why
Clang-format is an external tool whose
output depends on its version, it rewrites correct hand-made layout, and its options
cannot express our coding standard or be tuned to it. `mynewt_format` is a style checker
owned by the Mynewt projects. In NimBLE it runs **next to** clang-format as an
informational check (for now).
## What it does
- **Fixes problems, never reformats:** each rule touches only the text that breaks it;
aligned `#define` groups and deliberate line breaks are kept.
- **Safe fixes:** a fix that would change what the compiler sees is discarded.
- **Checks only changed lines by default** (`--whole-files` checks everything).
- **Modes:** report, `-d` patch, `-f` fix, `-i` review fixes one by one;
`--list-rules` / `--explain RULE` document the rules.
- Honours inline suppressions.
## Changes
- `tools/mynewt_format.py`, `tools/mynewt_style/`: the tool, its rules, tests and docs,
including `tools/mynewt_style/CODING_STANDARDS.md`. **This is a copy of the version
maintained in apache-mynewt-core.**
- `newt-coding-rules`: NimBLE's configuration, including the module prefixes NimBLE
functions use (`ble_`, `nimble_`; `bt_` and friends in mesh).
- `newt-coding-rules-ignore`: external code, the syscfg/logcfg headers generated by newt
and the vendored FreeBSD `queue.h`.
- `.github/workflows/compliance_check.yml`: new job **"Coding style (mynewt_format,
informational)"**: checks the lines changed by the PR, prints problems and a patch with
proposed fixes, **never fails the build**.
- `.github/workflows/sync_mynewt_format.yml`: daily job that copies the tool from
apache-mynewt-core (like the existing `.clang-format` sync). It does nothing until core
provides the tool, so the two PRs can be merged in either order.
## Not changed
- The clang-format CI check, its daily sync, `.clang-format` and `.clang-format-ignore`.
- `CODING_STANDARDS.md` at the repository root.
## Validation
- 81 unit tests; the whole repository passes the fix-safety and idempotence checks.
- Checked against all NimBLE lines committed in the last year: apart from the return
type rule, only genuine problems were reported (tabs in the Zephyr-derived mesh code, a
few lines over 100 columns)
## Try it
python3 tools/mynewt_format.py --git-diff origin/master
python3 tools/mynewt_format.py -i
python3 -m unittest discover -s tools/mynewt_style/tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Introduction of new custom code formatting tool [mynewt-nimble]
Posted by "szymon-czapracki (via GitHub)" <gi...@apache.org>.
szymon-czapracki closed pull request #2319: Introduction of new custom code formatting tool
URL: https://github.com/apache/mynewt-nimble/pull/2319
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org