-
Notifications
You must be signed in to change notification settings - Fork 247
Enable NRT for AlarmOccurrence,Attachment, Attendee, CalendarDataType, Duration, ICalendarDataType, ICalendarParameterCollectionContainer
#762
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
Conversation
Codecov ReportAttention: Patch coverage is ❌ Your patch status has failed because the patch coverage (36%) is below the target coverage (80%). You can increase the patch coverage or adjust the target coverage. @@ Coverage Diff @@
## main #762 +/- ##
===================================
- Coverage 67% 67% -0%
===================================
Files 104 104
Lines 4508 4498 -10
Branches 1103 1107 +4
===================================
- Hits 3012 3001 -11
- Misses 1065 1068 +3
+ Partials 431 429 -2
🚀 New features to boost your workflow:
|
d2d1822 to
d482732
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
Ical.Net/Evaluation/TimeZoneInfoEvaluator.cs:27
- The null-check for TimeZoneInfo was removed; consider restoring or adjusting this check to prevent potential NullReferenceExceptions if TimeZoneInfo remains unset.
if (TimeZoneInfo == null)
Ical.Net/DataTypes/PeriodList.cs:131
- Using the null-conditional operator may silently fail to remove an item if Periods is null; ensure that Periods is initialized or handle the null case explicitly.
public void RemoveAt(int index) => Periods?.RemoveAt(index);
| } | ||
|
|
||
| public int CompareTo(AlarmOccurrence other) => Period.CompareTo(other.Period); | ||
| public int CompareTo(AlarmOccurrence? other) |
Copilot
AI
Apr 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] In the CompareTo method, returning 1 when other or its Period is null could result in inconsistent ordering; consider defining explicit ordering when both Period properties are null.
AlarmOccurrence,Attachment, Attendee, CalendarDataType, DurationAlarmOccurrence,Attachment, Attendee, CalendarDataType, Duration, ICalendarDataType, ICalendarParameterCollectionContainer
ff53acc to
78f6218
Compare
minichma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, just a few minor comments.
Ical.Net/DataTypes/Duration.cs
Outdated
| /// </summary> | ||
| /// <exception cref="System.FormatException">Thrown if the value is not a valid duration.</exception> | ||
| public static Duration Parse(string value) => (Duration)new DurationSerializer().Deserialize(new StringReader(value)); | ||
| public static Duration? Parse(string value) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we are somewhat inconsistent here. According to the XML doc the method should throw if the passed string is not a valid duration. DurationSerializer throws in some cases and returns null in other. I'd generally suggest to throw and return a non-nullable Duration.
Ical.Net/DataTypes/PeriodList.cs
Outdated
| foreach (var p in list) | ||
| { | ||
| Add(p.Copy<Period>()); | ||
| if (p != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By not copying null values the copy will not be equal to the original. Maybe to do something like Add(p?.Copy<Period>())?
Ical.Net/DataTypes/PeriodList.cs
Outdated
| EnsureConsistentTimezoneAndPeriodKind(item); | ||
| if (Periods.Contains(item)) return; | ||
| Periods.Insert(index, item); | ||
| Periods?.Insert(index, item); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ? hast just been removed one commit earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
Ical.Net/DataTypes/Attendee.cs
Outdated
| && Members.SequenceEqual(other.Members) | ||
| && DelegatedTo.SequenceEqual(other.DelegatedTo) | ||
| && DelegatedFrom.SequenceEqual(other.DelegatedFrom); | ||
| && (DelegatedTo?.SequenceEqual(other.DelegatedTo ?? Enumerable.Empty<string>()) ?? other.DelegatedTo == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comparison is not commutative this way. I.e. if one is null and the other is empty, then the comparison is not symmetrical. Not sure though, whether an empty sequence should equal null. Usually they're considered different.
Ical.Net/DataTypes/Attachment.cs
Outdated
| return Data == null | ||
| ? firstPart | ||
| : firstPart && Data.SequenceEqual(other.Data); | ||
| : firstPart && other?.Data != null && Data.SequenceEqual(other.Data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comparison is not correct. If other?.Data == null, then this.Data is ignored, even if it contains data.
|
|
||
| var recurringPeriods1 = rpe1.Evaluate(new CalDateTime(start), start, end, default).ToList(); | ||
| var recurringPeriods2 = rpe2.Evaluate(new CalDateTime(start), start, end, default).ToList(); | ||
| var recurringPeriods1 = rpe1.Evaluate(new CalDateTime(start), start, end, null).ToList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, better. I started with default because the options should have been a value type at first.
| public int CompareTo(AlarmOccurrence other) => Period.CompareTo(other.Period); | ||
| public int CompareTo(AlarmOccurrence? other) | ||
| { | ||
| if (other == null || other.Period == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if other.Period == null and this.Period == null?
|
Love your reviews, thanks! |
minichma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
| public static Duration? Parse(string value) => | ||
| (Duration?) new DurationSerializer().Deserialize(new StringReader(value)); | ||
| public static Duration Parse(string value) => | ||
| (Duration) new DurationSerializer().Deserialize(new StringReader(value))!; // throws if null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it doesn't throw in all cases as of today (
| return null; |
|



Now < 100 files left for NRT :) - 30% done