Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks
mary-georgiou-sonarsource opened this issue Apr 14, 2023 · 1 comment · Fixed by #7509
Assignees
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues.
Milestone

Comments

@mary-georgiou-sonarsource
Copy link
Contributor

mary-georgiou-sonarsource commented Apr 14, 2023

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.

  • Implement Rule S6588 for C#
  • Implement Rule S6588 for VB.NET
@mary-georgiou-sonarsource mary-georgiou-sonarsource added Type: New Feature Area: VB.NET VB.NET rules related issues. Area: C# C# rules related issues. labels Apr 14, 2023
@csaba-sagi-sonarsource csaba-sagi-sonarsource changed the title New rule S6588: Use DateTime(Offset).UnixEpoch instead of pointing to that date using the constructor New rule S6588: Use DateTime(Offset).UnixEpoch instead of pointing to that date using the constructor Apr 14, 2023
@csaba-sagi-sonarsource
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues.
Projects
None yet
4 participants