Skip to content

[repo-assist] refactor: replace last sprintf with string interpolation in DefinitionCompiler#439

Merged
sergey-tihon merged 2 commits into
masterfrom
repo-assist/improve-remove-last-sprintf-20260516-f07b325bab369826
May 16, 2026
Merged

[repo-assist] refactor: replace last sprintf with string interpolation in DefinitionCompiler#439
sergey-tihon merged 2 commits into
masterfrom
repo-assist/improve-remove-last-sprintf-20260516-f07b325bab369826

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Replaces the sole remaining sprintf call in production code with the conditional string-interpolation pattern already established in Utils.fs:

Before

let newName = sprintf "%s%s" prefix (if i = 0 then "" else i.ToString())

After

let newName = if i = 0 then prefix else $"{prefix}{i}"

This is the same pattern already used in UniqueNameGenerator.findUniq (Utils.fs):

let newName = if i = 0 then prefix else $"{prefix}{i}"
let key = if i = 0 then prefixLower else $"{prefixLower}{i}"

Rationale

  • Removes the intermediate i.ToString() allocation before the sprintf format call
  • Makes DefinitionCompiler consistent with Utils.fs
  • Removes the last sprintf from production source code (only one remained)
  • No behavior change — semantics are identical

Test Status

✅ Build succeeded (0 errors, 210 warnings — pre-existing)
✅ All 417 unit tests passed

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@79c99dfd73f3b7ad8ab2b0f4944838018dbe4736

…nCompiler

Replace the sole remaining `sprintf` call in production code with the
conditional string-interpolation pattern already used in Utils.fs
(UniqueNameGenerator.findUniq).

- sprintf "%s%s" prefix (if i = 0 then "" else i.ToString())
+ if i = 0 then prefix else $"{prefix}{i}"

This removes the intermediate string allocation from i.ToString() before
the format call, and is consistent with the identical pattern in
UniqueNameGenerator.findUniq.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sergey-tihon sergey-tihon marked this pull request as ready for review May 16, 2026 20:16
Copilot AI review requested due to automatic review settings May 16, 2026 20:16
@sergey-tihon sergey-tihon merged commit 15a9545 into master May 16, 2026
4 checks passed
@sergey-tihon sergey-tihon deleted the repo-assist/improve-remove-last-sprintf-20260516-f07b325bab369826 branch May 16, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Trivial refactor replacing the final sprintf in DefinitionCompiler.fs with a string-interpolation pattern already established in Utils.fs's UniqueNameGenerator.findUniq.

Changes:

  • Replace sprintf "%s%s" prefix (if i = 0 then "" else i.ToString()) with if i = 0 then prefix else $"{prefix}{i}"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants