< Summary - Jellyfin

Information
Class: MediaBrowser.Controller.Entities.LinkedChildComparer
Assembly: MediaBrowser.Controller
File(s): /srv/git/jellyfin/MediaBrowser.Controller/Entities/LinkedChildComparer.cs
Line coverage
20%
Covered lines: 2
Uncovered lines: 8
Coverable lines: 10
Total lines: 52
Line coverage: 20%
Branch coverage
0%
Covered branches: 0
Total branches: 14
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 1/23/2026 - 12:11:06 AM Line coverage: 33.3% (2/6) Branch coverage: 0% (0/6) Total lines: 355/4/2026 - 12:15:16 AM Line coverage: 20% (2/10) Branch coverage: 0% (0/14) Total lines: 52 1/23/2026 - 12:11:06 AM Line coverage: 33.3% (2/6) Branch coverage: 0% (0/6) Total lines: 355/4/2026 - 12:15:16 AM Line coverage: 20% (2/10) Branch coverage: 0% (0/14) Total lines: 52

Coverage delta

Coverage delta 14 -14

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Equals(...)0%4260%
GetHashCode(...)0%7280%

File(s)

/srv/git/jellyfin/MediaBrowser.Controller/Entities/LinkedChildComparer.cs

#LineLine coverage
 1#nullable disable
 2
 3#pragma warning disable CS1591
 4
 5using System;
 6using System.Collections.Generic;
 7using MediaBrowser.Model.IO;
 8
 9namespace MediaBrowser.Controller.Entities
 10{
 11    public class LinkedChildComparer : IEqualityComparer<LinkedChild>
 12    {
 13        private readonly IFileSystem _fileSystem;
 14
 15        public LinkedChildComparer(IFileSystem fileSystem)
 16        {
 3517            _fileSystem = fileSystem;
 3518        }
 19
 20        public bool Equals(LinkedChild x, LinkedChild y)
 21        {
 022            if (x.Type != y.Type)
 23            {
 024                return false;
 25            }
 26
 27            // Compare by ItemId first (preferred)
 028            if (x.ItemId.HasValue && y.ItemId.HasValue)
 29            {
 030                return x.ItemId.Value.Equals(y.ItemId.Value);
 31            }
 32
 33#pragma warning disable CS0618 // Type or member is obsolete - fallback for shortcut/legacy comparison
 34            // Fall back to Path comparison for shortcuts and legacy data
 035            return _fileSystem.AreEqual(x.Path, y.Path);
 36#pragma warning restore CS0618
 37        }
 38
 39        public int GetHashCode(LinkedChild obj)
 40        {
 41            // Use ItemId for hash if available, otherwise fall back to legacy fields
 042            if (obj.ItemId.HasValue && !obj.ItemId.Value.Equals(Guid.Empty))
 43            {
 044                return HashCode.Combine(obj.ItemId.Value, obj.Type);
 45            }
 46
 47#pragma warning disable CS0618 // Type or member is obsolete - fallback for shortcut/legacy hashing
 048            return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode(StringCompa
 49#pragma warning restore CS0618
 50        }
 51    }
 52}