< Summary - Results for net9.0, Release

Information
Class: LockCheck.Linux.Extensions
Assembly: LockCheck
File(s): /home/runner/work/LockCheck/LockCheck/src/LockCheck/Linux/Extensions.cs
Tag: 96_11660771111
Line coverage
75%
Covered lines: 6
Uncovered lines: 2
Coverable lines: 8
Total lines: 31
Line coverage: 75%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsFileLocked(...)50%9875%

File(s)

/home/runner/work/LockCheck/LockCheck/src/LockCheck/Linux/Extensions.cs

#LineLine coverage
 1using System;
 2using System.IO;
 3
 4namespace LockCheck.Linux;
 5
 6internal static class Extensions
 7{
 8    public static bool IsFileLocked(Exception exception)
 9    {
 210        if (exception == null)
 211            throw new ArgumentNullException(nameof(exception));
 12
 13        // Unix is... complicated. For EACCES, the runtime does throw a UnauthorizedAccessException,
 14        // with potentially an inner exception of type IOException.
 15
 216        if (exception is UnauthorizedAccessException ua &&
 217            ua.InnerException is IOException ioException)
 18        {
 019            return ioException.HResult == NativeMethods.EACCES;
 20        }
 21
 22        // EWOULDBLOCK is directly thrown as an IOException with the respective code.
 23
 224        if (exception is IOException ioException2)
 25        {
 226            return ioException2.HResult == NativeMethods.EWOULDBLOCK;
 27        }
 28
 029        return false;
 30    }
 31}

Methods/Properties

IsFileLocked(System.Exception)