Skip to content

refactor: simplify single-statement lambda expressions#211

Merged
StuartFerguson merged 1 commit into
masterfrom
deepsource-autofix-7a7f9296
Sep 22, 2025
Merged

refactor: simplify single-statement lambda expressions#211
StuartFerguson merged 1 commit into
masterfrom
deepsource-autofix-7a7f9296

Conversation

@deepsource-autofix

Copy link
Copy Markdown
Contributor

This PR refactors multiple lambda expressions that only contain a single statement, converting them from block-bodied forms with braces and explicit return keywords to concise expression-bodied lambdas. Across service registrations, domain logic, and test assertions, redundant braces and return statements have been removed to improve readability and reduce verbosity.

  • Consider simplifying lambda when its body has a single statement: Many lambdas in service registration (e.g., AddSingleton<Func<String, String>>, AddSingleton<Func<String, Int32, ISubscriptionRepository>>) and in tests (e.g., Should.Throw, Should.NotThrow, Retry.For) were written with braces wrapping a single return or await call. Each of these has been converted to an expression-bodied lambda, eliminating unnecessary braces and return/async block syntax.

This Autofix was generated by AI. Please review the change before merging.

This PR refactors multiple lambda expressions that only contain a single statement, converting them from block-bodied forms with braces and explicit return keywords to concise expression-bodied lambdas. Across service registrations, domain logic, and test assertions, redundant braces and return statements have been removed to improve readability and reduce verbosity.

- Consider simplifying lambda when its body has a single statement: Many lambdas in service registration (e.g., `AddSingleton<Func<String, String>>`, `AddSingleton<Func<String, Int32, ISubscriptionRepository>>`) and in tests (e.g., `Should.Throw`, `Should.NotThrow`, `Retry.For`) were written with braces wrapping a single return or await call. Each of these has been converted to an expression-bodied lambda, eliminating unnecessary braces and `return`/`async` block syntax.

> This Autofix was generated by AI. Please review the change before merging.
@deepsource-io

deepsource-io Bot commented Sep 22, 2025

Copy link
Copy Markdown

Here's the code health analysis summary for commits e251d66..154a4c4. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource C# LogoC#❌ Failure
❗ 1 occurence introduced
🎯 17 occurences resolved
View Check ↗
DeepSource Docker LogoDocker✅ SuccessView Check ↗
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗
DeepSource SQL LogoSQL✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@StuartFerguson StuartFerguson merged commit 7ecfeb4 into master Sep 22, 2025
12 of 14 checks passed
@github-actions github-actions Bot deleted the deepsource-autofix-7a7f9296 branch November 22, 2025 00:48
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