Steeltoe
Steeltoe copied to clipboard
Address S6354: Use a testable date/time provider
Address existing violations of S6354: Use a testable date/time provider in the codebase and set severity to Warning in Steeltoe.Debug.ruleset and Steeltoe.Release.ruleset.
To find existing violations, enable the rule (see above) and rebuild src/Steeltoe.All.sln to make them appear in the Output window. Additionally, search the codebase for usages for DateTime[Offset].[Utc]Now.
To address the violations, choose from the following on a case-by-case basis:
- Instead of introducing our own clock, use the
Microsoft.AspNetCore.Authentication.ISystemClockabstraction, for now - ~Suppress the violation in code using
#pragma warning disable/restore, preceded by a justification comment if not obvious~