Skip to content

reduce duplication - #27

Merged
TopSwagCode merged 1 commit into
masterfrom
feature/reduce-duplication
Feb 12, 2026
Merged

TopSwagCode merged 1 commit into
masterfrom
feature/reduce-duplication

Conversation

@TopSwagCode

Copy link
Copy Markdown
Owner

No description provided.

@TopSwagCode
TopSwagCode requested a review from Copilot February 12, 2026 15:46
@TopSwagCode
TopSwagCode merged commit 81b651d into master Feb 12, 2026
4 checks passed

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

Refactors WorkerEmitter in MinimalWorker’s source generator to reduce duplicated code emission across continuous, periodic, and cron worker initializers by extracting common emission patterns into helper methods.

Changes:

  • Extracted repeated code emission blocks (dependency validation, DI parameter resolution, delegate invocation, telemetry/activity setup, success/error/duration recording, deactivation logging) into dedicated private helper methods.
  • Standardized worker “type” usage by introducing a local workerType constant per worker initializer and passing it through common helpers.

sb.AppendLine($"{indent} {{ \"worker.id\", workerId }},");
sb.AppendLine($"{indent} {{ \"worker.name\", workerName }},");
sb.AppendLine($"{indent} {{ \"worker.type\", \"{workerType}\" }}");
sb.AppendLine($"{indent}}};");

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

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

EmitTagListInit emits interpolated strings that contain literal } characters without escaping them (e.g., the lines emitting { "worker.id", workerId }, and { "worker.name", workerName },). In interpolated strings, literal closing braces must be escaped (}}), otherwise this won’t compile. Please update those AppendLine calls to properly escape the closing braces (or switch those lines to non-interpolated strings with a separate indent prefix).

Suggested change
sb.AppendLine($"{indent}}};");
sb.AppendLine(indent + "};");

Copilot uses AI. Check for mistakes.
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.

2 participants