Skip to content

Conversation

@axunonb
Copy link
Collaborator

@axunonb axunonb commented Apr 14, 2025

Enable NRT for ical.net (top) namespace

@codecov
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

Attention: Patch coverage is 44.08602% with 52 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
Ical.Net/DataTypes/Attendee.cs 0% 0 Missing and 13 partials ⚠️
Ical.Net/CalendarCollection.cs 0% 10 Missing ⚠️
Ical.Net/ServiceProvider.cs 40% 8 Missing and 1 partial ⚠️
Ical.Net/Calendar.cs 60% 3 Missing and 3 partials ⚠️
Ical.Net/CalendarProperty.cs 73% 3 Missing ⚠️
Ical.Net/CalendarComponents/FreeBusy.cs 0% 2 Missing ⚠️
Ical.Net/CalendarParameter.cs 75% 2 Missing ⚠️
Ical.Net/CalendarObject.cs 67% 1 Missing ⚠️
Ical.Net/CalendarPropertyList.cs 50% 0 Missing and 1 partial ⚠️
Ical.Net/Collections/GroupedList.cs 0% 1 Missing ⚠️
... and 4 more

❌ Your patch status has failed because the patch coverage (44%) is below the target coverage (80%). You can increase the patch coverage or adjust the target coverage.
❌ Your project status has failed because the head coverage (67%) is below the target coverage (80%). You can increase the head coverage or adjust the target coverage.

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #771   +/-   ##
===================================
  Coverage    67%    67%           
===================================
  Files       104    104           
  Lines      4490   4483    -7     
  Branches   1111   1103    -8     
===================================
- Hits       2998   2994    -4     
  Misses     1064   1064           
+ Partials    428    425    -3     
Files with missing lines Coverage Δ
Ical.Net/CalendarExtensions.cs 100% <ø> (ø)
Ical.Net/CalendarObjectExtensions.cs 100% <100%> (ø)
Ical.Net/DataTypes/Attachment.cs 78% <100%> (+3%) ⬆️
Ical.Net/DataTypes/Organizer.cs 44% <100%> (ø)
Ical.Net/DefaultTimeZoneResolver.cs 68% <ø> (ø)
Ical.Net/Proxies/ParameterCollectionProxy.cs 50% <ø> (ø)
Ical.Net/Serialization/PropertySerializer.cs 83% <100%> (ø)
Ical.Net/TimeZoneResolvers.cs 100% <100%> (ø)
Ical.Net/CalendarObject.cs 64% <67%> (+1%) ⬆️
Ical.Net/CalendarPropertyList.cs 56% <50%> (-4%) ⬇️
... and 12 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@axunonb axunonb force-pushed the wip/axunonb/pr/nrt-ical.net-namespace branch from 9058219 to c19db97 Compare April 14, 2025 14:38
@axunonb axunonb force-pushed the wip/axunonb/pr/nrt-ical.net-namespace branch from c19db97 to 2d83ef3 Compare April 18, 2025 08:05
@axunonb axunonb requested a review from minichma April 22, 2025 20:20
@axunonb axunonb marked this pull request as ready for review April 22, 2025 20:21
minichma
minichma previously approved these changes Apr 23, 2025
Copy link
Collaborator

@minichma minichma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, a significant improvement!

A comment on making reviews somewhat more efficient: It would be helpful to keep changes apart in separate commits that can be reviewed independently. E.g. pure formatting changes (line breaks, spacing, ...), especially when applied by formatting tools, usually don't require the level of attention that functional changes do, so it would be helpful to have them in a separate commit that can be skimmed over very quickly. Functional changes, that are independent of each other could also be committed separately. Example:

  • Commit: Pure formatting changes
  • Commit: Unrelated functional change 1
  • Commit: Unrelated functional change 2
  • Commit: Preparatory functional change 1 required for implementing NRT
  • Commit: Preparatory functional change 2 required for implementing NRT
  • Commit: NRT
  • Commit: Documentation changes
  • ...

Not a big deal, just because time is very limited on all ends ;-)

var recurrenceIdsAndUids = this.Children.OfType<IRecurrable>()
.Where(r => r.RecurrenceId != null)
.Select(r => new { (r as IUniqueComponent)?.Uid, Dt = r.RecurrenceId.Value })
.Select(r => new { ((IUniqueComponent) r).Uid, Dt = r.RecurrenceId!.Value })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if r is not an IUniqueComponent? Previously we'd have returned null, now it would fail with an invalid cast.

return (T) cal;
}
return default(T);
throw new ArgumentException($"Creating {typeof(T)} failed.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Not sure what Type.ToString() produces, but maybe specify something like typeof(T).FullName?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$"{typeof(T)}" will indeed render the fully qualified name of the type T as a string

return this.Aggregate<Calendar, FreeBusy?>(null, (current, iCal) =>
{
var freeBusy = iCal.GetFreeBusy(freeBusyRequest);
return current is null ? freeBusy : CombineFreeBusy(current, freeBusy!);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, if freeBusy could be null here, we shouldn't apply !. Not sure, what the right behavior is but either GetFreeBusy() should return not-null or we should deal with nulls here.

return this.Aggregate<Calendar, FreeBusy?>(null, (current, iCal) =>
{
var freeBusy = iCal.GetFreeBusy(organizer, contacts, fromInclusive, toExclusive);
return current is null ? freeBusy : CombineFreeBusy(current, freeBusy!);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

freeBusy! - same as above

@sonarqubecloud
Copy link

@axunonb axunonb requested a review from minichma April 27, 2025 12:35
Copy link
Collaborator

@minichma minichma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the remaining/new null reference warnings be considered?

var recurrenceIdsAndUids = this.Children.OfType<IRecurrable>()
.Where(r => r.RecurrenceId != null)
.Select(r => new { ((IUniqueComponent) r).Uid, Dt = r.RecurrenceId!.Value })
.Select(r => new { (r as IUniqueComponent).Uid, Dt = r.RecurrenceId!.Value })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could throw with a npe now.

@axunonb
Copy link
Collaborator Author

axunonb commented Apr 28, 2025

Should the remaining/new null reference warnings be considered?

Yes, they should or rather: must.
After all NRT related PRs are merged, a couple of more NRT warnings are to be expected.
So there will be another, hopefully final PR for NRT.

@axunonb
Copy link
Collaborator Author

axunonb commented Apr 28, 2025

Thanks for your time and feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants