Skip to content

fix: achieve zero-warning build across all projects#1239

Open
cesarcastrocuba wants to merge 2 commits intofullstackhero:developfrom
cesarcastrocuba:fix/zero-warnings
Open

fix: achieve zero-warning build across all projects#1239
cesarcastrocuba wants to merge 2 commits intofullstackhero:developfrom
cesarcastrocuba:fix/zero-warnings

Conversation

@cesarcastrocuba
Copy link
Copy Markdown
Contributor

Build infrastructure

  • Directory.Build.props: suppress MSG0005 globally (Mediator domain events without registered handlers — intentional, handlers wired up at runtime)
  • src/.editorconfig: suppress CA1054, CA1056 (URI string params are intentional API design), MSG0005 (redundant after Build.props change)

BuildingBlocks — Quota

  • InMemoryQuotaService, RedisQuotaService: change _gauges field type from IReadOnlyDictionary to Dictionary (CA1859 — use concrete type for perf)
  • InMemoryQuotaStore: add SuppressMessage CA1812 — class is instantiated by the DI container, invisible to static analysis
  • NoopQuotaService: same CA1812 suppression for DI-instantiated class
  • QuotaOptions.Plans: change { get; set; } to { get; } — collection is mutated in-place; the setter was never used (CA2227)
  • Quota.csproj: remove redundant Microsoft.Extensions.* package references that are already transitively pulled by other dependencies

BuildingBlocks — Mailing

  • SmtpMailService: guard AuthenticateAsync call — only authenticate when both UserName and Password are present, avoiding null argument exceptions and supporting anonymous SMTP relays (CS8604 null safety fix)

BuildingBlocks — Storage

  • Storage.csproj: remove BOM character from file header and remove redundant Microsoft.Extensions.Logging.Abstractions reference

BuildingBlocks — Web

  • Versioning/Extensions.cs: add ArgumentNullException.ThrowIfNull(services) to fix CA1062 (validate non-nullable parameters in public methods)

Modules — Auditing

  • AuditingModule.cs: add ArgumentNullException.ThrowIfNull(endpoints) to fix CA1062

Modules — Multitenancy

  • MultitenancyModule.cs: add ArgumentNullException.ThrowIfNull(endpoints) to fix CA1062
  • AppTenantInfoConfiguration.cs: add ArgumentNullException.ThrowIfNull(builder) to fix CA1062

Modules — Billing

  • BillingService.cs: wrap LogInformation calls in IsEnabled(Information) guards to fix CA1873 (avoid potentially expensive logging)
  • MonthlyInvoiceJob.cs: same CA1873 fix for both log calls
  • UsageReporter.cs: same CA1873 fix

Modules — Catalog (Contracts)

  • SearchBrandsQuery.cs: replace misplaced XML /// comments inside record positional parameters with standard // comments (CS1587/CS1573)
  • SearchCategoriesQuery.cs: same CS1587/CS1573 fix
  • SearchProductsQuery.cs: same CS1587/CS1573 fix

Modules — Catalog (Implementation)

  • CatalogDbInitializer.cs: wrap LogInformation in IsEnabled guard (CA1873)
  • ListTrashedBrandsQueryHandler.cs: rewrite comment to remove S125 false positive (comment contained brackets that Sonar read as code)
  • SearchBrandsQueryHandler.cs: replace ToLowerInvariant with ToUpperInvariant and update switch labels to fix CA1308 (prefer upper-case normalization)
  • SearchCategoriesQueryHandler.cs: same CA1308 fix
  • SearchProductsQueryHandler.cs: same CA1308 fix
  • GetCategoryTreeQueryHandler.cs: replace GroupBy+ToDictionary with ToLookup which handles null keys natively, removing the TryGetValue null guard

Modules — Identity (Contracts)

  • IIdentityService.cs: fix XML doc param name (tenant -> twoFactorCode) and remove stray BOM character
  • ISessionService.cs: add missing cancellationToken XML doc param tag

Modules — Identity (Implementation)

  • RolePermissionSyncHostedService.cs: wrap LogDebug in IsEnabled guard (CA1873)
  • RolePermissionSyncer.cs: wrap LogInformation in IsEnabled guard (CA1873)
  • GetTenantSessionsValidator.cs: add missing FluentValidation validator for GetTenantSessionsQuery to satisfy architecture rule requiring all paginated queries to have a validator (PageNumber >= 1, PageSize >= 1)

Modules — Tickets

  • SearchTicketsQueryHandler.cs: replace ToLowerInvariant with ToUpperInvariant in sort switch to fix CA1308
  • TicketComment.cs: restore private set on ISoftDeletable properties with #pragma suppress for S1144 — EF Core writes these via SaveChanges interceptor (entry.Property(...).CurrentValue) which bypasses C# setters and is invisible to static analysis; removing the setter would break domain model consistency with other ISoftDeletable entities

Modules — Webhooks

  • WebhookDispatchJob.cs: wrap logging calls in IsEnabled guards (CA1873); add parameterless constructor to WebhookDeliveryFailedException (CA1032 — custom exceptions should provide all four standard constructors)
  • WebhookDispatchJobTests.cs: wrap DispatchAsync call in Should.NotThrowAsync to correctly assert the no-throw expectation

Result

Build succeeded with 0 warnings, 0 errors across all 37 projects.

## Build infrastructure
- Directory.Build.props: suppress MSG0005 globally (Mediator domain events
  without registered handlers — intentional, handlers wired up at runtime)
- src/.editorconfig: suppress CA1054, CA1056 (URI string params are
  intentional API design), MSG0005 (redundant after Build.props change)

## BuildingBlocks — Quota
- InMemoryQuotaService, RedisQuotaService: change _gauges field type from
  IReadOnlyDictionary to Dictionary (CA1859 — use concrete type for perf)
- InMemoryQuotaStore: add SuppressMessage CA1812 — class is instantiated
  by the DI container, invisible to static analysis
- NoopQuotaService: same CA1812 suppression for DI-instantiated class
- QuotaOptions.Plans: change { get; set; } to { get; } — collection is
  mutated in-place; the setter was never used (CA2227)
- Quota.csproj: remove redundant Microsoft.Extensions.* package references
  that are already transitively pulled by other dependencies

## BuildingBlocks — Mailing
- SmtpMailService: guard AuthenticateAsync call — only authenticate when
  both UserName and Password are present, avoiding null argument exceptions
  and supporting anonymous SMTP relays (CS8604 null safety fix)

## BuildingBlocks — Storage
- Storage.csproj: remove BOM character from file header and remove
  redundant Microsoft.Extensions.Logging.Abstractions reference

## BuildingBlocks — Web
- Versioning/Extensions.cs: add ArgumentNullException.ThrowIfNull(services)
  to fix CA1062 (validate non-nullable parameters in public methods)

## Modules — Auditing
- AuditingModule.cs: add ArgumentNullException.ThrowIfNull(endpoints)
  to fix CA1062

## Modules — Multitenancy
- MultitenancyModule.cs: add ArgumentNullException.ThrowIfNull(endpoints)
  to fix CA1062
- AppTenantInfoConfiguration.cs: add ArgumentNullException.ThrowIfNull(builder)
  to fix CA1062

## Modules — Billing
- BillingService.cs: wrap LogInformation calls in IsEnabled(Information)
  guards to fix CA1873 (avoid potentially expensive logging)
- MonthlyInvoiceJob.cs: same CA1873 fix for both log calls
- UsageReporter.cs: same CA1873 fix

## Modules — Catalog (Contracts)
- SearchBrandsQuery.cs: replace misplaced XML /// comments inside record
  positional parameters with standard // comments (CS1587/CS1573)
- SearchCategoriesQuery.cs: same CS1587/CS1573 fix
- SearchProductsQuery.cs: same CS1587/CS1573 fix

## Modules — Catalog (Implementation)
- CatalogDbInitializer.cs: wrap LogInformation in IsEnabled guard (CA1873)
- ListTrashedBrandsQueryHandler.cs: rewrite comment to remove S125
  false positive (comment contained brackets that Sonar read as code)
- SearchBrandsQueryHandler.cs: replace ToLowerInvariant with ToUpperInvariant
  and update switch labels to fix CA1308 (prefer upper-case normalization)
- SearchCategoriesQueryHandler.cs: same CA1308 fix
- SearchProductsQueryHandler.cs: same CA1308 fix
- GetCategoryTreeQueryHandler.cs: replace GroupBy+ToDictionary with ToLookup
  which handles null keys natively, removing the TryGetValue null guard

## Modules — Identity (Contracts)
- IIdentityService.cs: fix XML doc param name (tenant -> twoFactorCode)
  and remove stray BOM character
- ISessionService.cs: add missing cancellationToken XML doc param tag

## Modules — Identity (Implementation)
- RolePermissionSyncHostedService.cs: wrap LogDebug in IsEnabled guard
  (CA1873)
- RolePermissionSyncer.cs: wrap LogInformation in IsEnabled guard (CA1873)
- GetTenantSessionsValidator.cs: add missing FluentValidation validator for
  GetTenantSessionsQuery to satisfy architecture rule requiring all paginated
  queries to have a validator (PageNumber >= 1, PageSize >= 1)

## Modules — Tickets
- SearchTicketsQueryHandler.cs: replace ToLowerInvariant with ToUpperInvariant
  in sort switch to fix CA1308
- TicketComment.cs: restore private set on ISoftDeletable properties with
  #pragma suppress for S1144 — EF Core writes these via SaveChanges
  interceptor (entry.Property(...).CurrentValue) which bypasses C# setters
  and is invisible to static analysis; removing the setter would break
  domain model consistency with other ISoftDeletable entities

## Modules — Webhooks
- WebhookDispatchJob.cs: wrap logging calls in IsEnabled guards (CA1873);
  add parameterless constructor to WebhookDeliveryFailedException (CA1032 —
  custom exceptions should provide all four standard constructors)
- WebhookDispatchJobTests.cs: wrap DispatchAsync call in Should.NotThrowAsync
  to correctly assert the no-throw expectation

## Result
Build succeeded with 0 warnings, 0 errors across all 37 projects.
Comment thread src/Host/FSH.Starter.Api/DevSeeding/DevDataSeeder.cs Fixed
GitHub Advanced Security flagged LogInformation passing SharedPassword
directly as an argument (high-severity alert). Replaced with a neutral
completion message that confirms seeding succeeded without exposing
the credential value to any log sink or aggregator.
@maxiar
Copy link
Copy Markdown
Contributor

maxiar commented May 10, 2026

Perfect contribution! Please @iammukeshm merge before it becomes outdated again as we continue building.

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