Skip to content

Auto-port 4.1: Add .editorconfig to enforce consistent coding style - #17209

Merged
normanmaurer merged 1 commit into
4.1from
auto-port-pr-17052-to-4.1
Aug 4, 2026
Merged

normanmaurer merged 1 commit into
4.1from
auto-port-pr-17052-to-4.1

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

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 .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 — 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.

## 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)
@normanmaurer
normanmaurer merged commit 576765b into 4.1 Aug 4, 2026
15 of 18 checks passed
@normanmaurer
normanmaurer deleted the auto-port-pr-17052-to-4.1 branch August 4, 2026 07:49
@normanmaurer normanmaurer added this to the 4.1.137.Final milestone Aug 4, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants