Skip to content

Commit aab4351

Browse files
author
Denis Levin
committed
A few more changes from code review
1 parent da2422c commit aab4351

File tree

6 files changed

+4
-4
lines changed

6 files changed

+4
-4
lines changed

csharp/ql/src/Likely Bugs/LeapYear/UnsafeYearConstruction.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<qhelp>
55
<overview>
66
<p>When creating a <code>System.DateTime</code> object by setting the year, month, and day in the constructor by performing an arithmetic operation on a different <code>DateTime</code> object, there is a risk that the date you are setting is invalid.</p>
7-
<p>On a leap year, such code may throw an <code>ArgumentOutOfRangeException</code> with a message of <code>"Year, Month, and Day parameters describe an un-representable DateTime."</code></p>
7+
<p>On a leap year, such code may throw an <code>ArgumentOutOfRangeException</code> with a message of <code>"Year, Month, and Day parameters describe an unrepresentable DateTime."</code></p>
88
</overview>
99
<recommendation>
1010
<p>Creating a <code>System.DateTime</code> object based on a different <code>System.DateTime</code> object, use the appropriate methods to manipulate the date instead of arithmetic.</p>

csharp/ql/src/Likely Bugs/LeapYear/UnsafeYearConstructionBad.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public UnsafeYearConstructionBad()
66
DateTime Start;
77
DateTime End;
88
var now = DateTime.UtcNow;
9-
// the base-date +/1 n years may not be a valid date.
9+
// the base-date +/- n years may not be a valid date.
1010
Start = new DateTime(now.Year - 1, now.Month, now.Day, 0, 0, 0, DateTimeKind.Utc);
1111
End = new DateTime(now.Year + 1, now.Month, now.Day, 0, 0, 1, DateTimeKind.Utc);
1212
}

csharp/ql/src/Likely Bugs/LeapYear/UnsafeYearConstructionGood.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
2-
public class UnsafeYearConstructionBad
2+
public class UnsafeYearConstructionGood
33
{
4-
public UnsafeYearConstructionBad()
4+
public UnsafeYearConstructionGood()
55
{
66
DateTime Start;
77
DateTime End;

csharp/ql/test/query-tests/Likely Bugs/LeapYear/UnsafeYearConstruction/Program.cs renamed to csharp/ql/test/query-tests/Likely Bugs/UnsafeYearConstruction/Program.cs

File renamed without changes.

csharp/ql/test/query-tests/Likely Bugs/LeapYear/UnsafeYearConstruction/UnsafeYearConstruction.expected renamed to csharp/ql/test/query-tests/Likely Bugs/UnsafeYearConstruction/UnsafeYearConstruction.expected

File renamed without changes.

csharp/ql/test/query-tests/Likely Bugs/LeapYear/UnsafeYearConstruction/UnsafeYearConstruction.qlref renamed to csharp/ql/test/query-tests/Likely Bugs/UnsafeYearConstruction/UnsafeYearConstruction.qlref

File renamed without changes.

0 commit comments

Comments
 (0)