Skip to content

Reduce ModelFactory.ConvertFrom parameter count from 9 to 8#1722

Merged
StuartFerguson merged 4 commits intomasterfrom
copilot/fix-modelfactory-convertfrom-parameters
Apr 8, 2026
Merged

Reduce ModelFactory.ConvertFrom parameter count from 9 to 8#1722
StuartFerguson merged 4 commits intomasterfrom
copilot/fix-modelfactory-convertfrom-parameters

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

ModelFactory.ConvertFrom(Guid, MerchantEntity, ...) in TransactionProcessor.Repository had 9 parameters, violating the Codacy complexity rule (limit: 8).

Changes

  • ModelFactory.cs — Collapsed the two related schedule parameters into a single named tuple, bringing the count to 8:
// Before
public static MerchantModel ConvertFrom(Guid estateId, MerchantEntity merchant,
    List<MerchantAddressEntity> merchantAddresses, List<MerchantContactEntity> merchantContacts,
    List<MerchantOperatorEntity> merchantOperators, List<MerchantDeviceEntity> merchantDevices,
    List<MerchantSecurityUserEntity> merchantSecurityUsers,
    List<MerchantScheduleEntity> merchantSchedules,
    List<MerchantScheduleMonthEntity> merchantScheduleMonths)

// After
public static MerchantModel ConvertFrom(Guid estateId, MerchantEntity merchant,
    List<MerchantAddressEntity> merchantAddresses, List<MerchantContactEntity> merchantContacts,
    List<MerchantOperatorEntity> merchantOperators, List<MerchantDeviceEntity> merchantDevices,
    List<MerchantSecurityUserEntity> merchantSecurityUsers,
    (List<MerchantScheduleEntity> Schedules, List<MerchantScheduleMonthEntity> Months) merchantScheduleData)
  • ITransactionProcessorReadModelRepository.cs (line ~357) — Call site that passed 7 null arguments switched to the existing 2-parameter overload.
  • ITransactionProcessorReadModelRepository.cs (line ~890) — Call site updated to pass the named tuple: (Schedules: s, Months: merchantScheduleMonths).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • f.feedz.io
    • Triggering command: /usr/bin/dotnet dotnet build TransactionProcessor.Repository/TransactionProcessor.Repository.csproj --no-restore -nologo (dns block)
    • Triggering command: /usr/bin/dotnet dotnet test TransactionProcessor.Tests/TransactionProcessor.Tests.csproj --no-restore -nologo (dns block)
    • Triggering command: /usr/bin/dotnet dotnet test TransactionProcessor.Tests/TransactionProcessor.Tests.csproj --no-restore -nologo -v normal (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 8, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

Copilot AI and others added 2 commits April 8, 2026 08:45
Copilot AI changed the title [WIP] Fix ModelFactory::ConvertFrom method to reduce parameters Reduce ModelFactory.ConvertFrom parameter count from 9 to 8 Apr 8, 2026
Copilot AI requested a review from StuartFerguson April 8, 2026 08:50
@StuartFerguson StuartFerguson marked this pull request as ready for review April 8, 2026 10:24
@StuartFerguson StuartFerguson merged commit e5f6ed8 into master Apr 8, 2026
7 checks passed
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.

[Complexity] Method ModelFactory::ConvertFrom has 9 parameters (limit is 8)

2 participants