SonarSource / sonar-dotnet

Code analyzer for C# and VB.NET projects
https://redirect.sonarsource.com/plugins/csharp.html
GNU Lesser General Public License v3.0
784 stars 226 forks source link

New rule S6588: Use `DateTime(Offset).UnixEpoch` instead of pointing to that date using the constructor #7080

Closed mary-georgiou-sonarsource closed 1 year ago

mary-georgiou-sonarsource commented 1 year ago

Implement new rule S6588: Use DateTime(Offset).UnixEpoch instead of pointing to that date using the constructor.

This rule should raise when a new DateTime, DateTimeOffset or DateOnly object is created with Date 1-1-1970.

csaba-sagi-sonarsource commented 1 year ago

The rule should not cover DateOnly, because it does not have a UnixEpoch field that could be used instead.