Repository navigation
Auto-port 4.1: Add .editorconfig to enforce consistent coding style - #17209
Merged
Merged
Conversation
## Motivation The Netty project has well-established coding conventions defined in its checkstyle configuration, but these are only enforced at build time and require specific tooling setup. Without an `.editorconfig` file, each IDE and editor must be configured individually to match the project's style, leading to inconsistent formatting, unnecessary whitespace changes in commits, and friction for contributors. `.editorconfig` is auto-detected by IntelliJ IDEA, VS Code, and many other editors — no plugin or configuration required. This lowers the barrier for new contributors and ensures consistent style out of the box. ## Modification Added `.editorconfig` at the project root with settings derived from the project's existing conventions, verified against actual source files and the canonical checkstyle configuration at [`netty-build/common/src/main/resources/io/netty/checkstyle.xml`](https://github.com/netty/netty-build/blob/master/common/src/main/resources/io/netty/checkstyle.xml) — `LineLength = 120`, `FileTabCharacter` (tab prohibition), `NewlineCheck` (LF), `NewlineAtEndOfFile`, trailing whitespace prohibition, UTF-8 charset: | File type | Indent | Details | |-----------|--------|---------| | `*.java` | 4 spaces | 120-char max line width | | `*.c`, `*.h` | 4 spaces | Native transport code | | `*.xml` | 4 spaces | POM and config files | | `*.{yml,yaml,json,js,css}` | 2 spaces | Build configs, web assets | | `*.{md,txt}` | 2 spaces | Documentation | | `*.properties` | 2 spaces | Maven wrapper, native-image config | | `*.sh` | 4 spaces | Build and CI scripts | | `Makefile` | tab | Required by GNU make | Global defaults for all files: UTF-8 encoding, LF line endings, final newline at end of file, no trailing whitespace. ## Result This is a formatting-only convention change with no behavioral impact. It ensures every editor shows code with the correct style automatically and provides the necessary foundation for automatic code formatters to enforce consistent style in CI pipelines. Addresses [#15642](#15642). Co-authored-by: Norman Maurer <[email protected]> (cherry picked from commit a96226c)
lltopk
pushed a commit
to lltopk/netty
that referenced
this pull request
Oct 24, 2026
…netty#17209) Auto-port of netty#17052 to 4.1 Cherry-picked commit: a96226c --- ## Motivation The Netty project has well-established coding conventions defined in its checkstyle configuration, but these are only enforced at build time and require specific tooling setup. Without an `.editorconfig` file, each IDE and editor must be configured individually to match the project's style, leading to inconsistent formatting, unnecessary whitespace changes in commits, and friction for contributors. `.editorconfig` is auto-detected by IntelliJ IDEA, VS Code, and many other editors — no plugin or configuration required. This lowers the barrier for new contributors and ensures consistent style out of the box. ## Modification Added `.editorconfig` at the project root with settings derived from the project's existing conventions, verified against actual source files and the canonical checkstyle configuration at [`netty-build/common/src/main/resources/io/netty/checkstyle.xml`](https://github.com/netty/netty-build/blob/master/common/src/main/resources/io/netty/checkstyle.xml) — `LineLength = 120`, `FileTabCharacter` (tab prohibition), `NewlineCheck` (LF), `NewlineAtEndOfFile`, trailing whitespace prohibition, UTF-8 charset: | File type | Indent | Details | |-----------|--------|---------| | `*.java` | 4 spaces | 120-char max line width | | `*.c`, `*.h` | 4 spaces | Native transport code | | `*.xml` | 4 spaces | POM and config files | | `*.{yml,yaml,json,js,css}` | 2 spaces | Build configs, web assets | | `*.{md,txt}` | 2 spaces | Documentation | | `*.properties` | 2 spaces | Maven wrapper, native-image config | | `*.sh` | 4 spaces | Build and CI scripts | | `Makefile` | tab | Required by GNU make | Global defaults for all files: UTF-8 encoding, LF line endings, final newline at end of file, no trailing whitespace. ## Result This is a formatting-only convention change with no behavioral impact. It ensures every editor shows code with the correct style automatically and provides the necessary foundation for automatic code formatters to enforce consistent style in CI pipelines. Addresses [netty#15642](netty#15642). Co-authored-by: Vasily Pelikh <[email protected]> Co-authored-by: Norman Maurer <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto-port of #17052 to 4.1
Cherry-picked commit: a96226c
Motivation
The Netty project has well-established coding conventions defined in its checkstyle configuration, but these are only enforced at build time and require specific tooling setup. Without an
.editorconfigfile, each IDE and editor must be configured individually to match the project's style, leading to inconsistent formatting, unnecessary whitespace changes in commits, and friction for contributors..editorconfigis auto-detected by IntelliJ IDEA, VS Code, and many other editors — no plugin or configuration required. This lowers the barrier for new contributors and ensures consistent style out of the box.Modification
Added
.editorconfigat the project root with settings derived from the project's existing conventions, verified against actual source files and the canonical checkstyle configuration atnetty-build/common/src/main/resources/io/netty/checkstyle.xml—LineLength = 120,FileTabCharacter(tab prohibition),NewlineCheck(LF),NewlineAtEndOfFile, trailing whitespace prohibition, UTF-8 charset:*.java*.c,*.h*.xml*.{yml,yaml,json,js,css}*.{md,txt}*.properties*.shMakefileGlobal defaults for all files: UTF-8 encoding, LF line endings, final newline at end of file, no trailing whitespace.
Result
This is a formatting-only convention change with no behavioral impact. It ensures every editor shows code with the correct style automatically and provides the necessary foundation for automatic code formatters to enforce consistent style in CI pipelines.
Addresses netty#15642.