Skip to content

clang-format: never split string literals - #1253

Merged
facontidavide merged 1 commit into
masterfrom
style/no-string-literal-split
Oct 24, 2026
Merged

facontidavide merged 1 commit into
masterfrom
style/no-string-literal-split

Conversation

@facontidavide

Copy link
Copy Markdown
Collaborator

PenaltyBreakString: 1 made breaking a string literal almost free, so clang-format would rather split a literal mid-word than wrap the call arguments, e.g.

exporter.addConverter<TestTypes::Temperature>(TestTypes::jsonFromTemperature, "Temperat"
                                                                                "ure");

This replaces it with BreakStringLiterals: false. Running clang-format over the whole tree with the new setting changes no existing file: clang-format never re-joins literals, so it only affects new code.

🤖 Generated with Claude Code

PenaltyBreakString: 1 made breaking a string literal nearly free, so
clang-format preferred splitting a literal mid-word ("Temperat" "ure")
over wrapping the call arguments. Reformatting the tree with the new
setting changes no existing file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@facontidavide
facontidavide merged commit 3f61069 into master Oct 24, 2026
18 checks passed
@facontidavide
facontidavide deleted the style/no-string-literal-split branch October 24, 2026 14:42
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.

1 participant