Skip to content

Change the suggested format token style - #913

Open
pirj wants to merge 2 commits into
masterfrom
change-stlye-of-named-format-token
Open

pirj wants to merge 2 commits into
masterfrom
change-stlye-of-named-format-token

Conversation

@pirj

@pirj pirj commented Dec 30, 2022

Copy link
Copy Markdown
Member

According to research:

annotated (%<name>s):
57497 files inspected, 5785 offenses detected

template (%{name}):
57497 files inspected, 1279 offenses detected

unannotated (%s)
57497 files inspected, 6424 offenses detected

the %{name} is the most commonly used style.

Related:

@pirj pirj self-assigned this Dec 30, 2022
@pirj
pirj requested a review from a team December 30, 2022 14:21
@pirj
pirj requested review from andyw8, bbatsov and koic April 18, 2023 20:17
@andyw8
andyw8 removed their request for review April 24, 2023 13:13
@bbatsov

bbatsov commented Jun 19, 2025

Copy link
Copy Markdown
Collaborator

I'm OK with updating this rule, but I'd rather suggest to change the language to something suggesting that both the name and annotated styles are fine.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 21:06
@pirj
pirj force-pushed the change-stlye-of-named-format-token branch from 2c950b9 to 58793de Compare October 5, 2026 21:06
According to [research](rubocop/rubocop#8827 (comment)):

annotated (`%<name>s`):
    57497 files inspected, 5785 offenses detected

template (`%{name}`):
    57497 files inspected, 1279 offenses detected

unannotated (`%s`)
    57497 files inspected, 6424 offenses detected

the `%{name}` is the most commonly used style.
The annotated is widely used and acceptable as well.
@pirj
pirj force-pushed the change-stlye-of-named-format-token branch from 58793de to d7a2e52 Compare October 5, 2026 21:08
@pirj

pirj commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

Updated. My apologies, I lost track of this for a while.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The guidance inaccurately describes conversion specifiers as encoding a value’s Ruby type.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Updates Ruby formatting guidance to favor template-style named tokens while retaining annotated tokens for advanced formatting.

Changes:

  • Revises sprintf examples to use named tokens.
  • Documents both named-token styles and their use cases.
File Description
README.adoc Updates named format-token guidance and examples.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.adoc Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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