Method ReadThread
has a Cognitive Complexity of 69 (exceeds 20 allowed). Consider refactoring. Open
unsafe void ReadThread()
{
if (!HandleAcquire()) { return; }
try
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ReadThread
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
unsafe void ReadThread()
{
if (!HandleAcquire()) { return; }
try
Method WriteThread
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
unsafe void WriteThread()
{
if (!HandleAcquire()) { return; }
try
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method WriteThread
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
unsafe void WriteThread()
{
if (!HandleAcquire()) { return; }
try
Method DeviceHandleFromPath
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
static int DeviceHandleFromPath(string path)
{
IntPtr udev = NativeMethods.udev_new();
if (IntPtr.Zero != udev)
{
Avoid deeply nested control flow statements. Open
if (error != NativeMethods.error.EAGAIN) { break; }
Avoid deeply nested control flow statements. Open
if (error == NativeMethods.error.EACCES)
{
throw new UnauthorizedAccessException("Not permitted to open HID class device at " + devnode + ".");
}
else
Method DeviceHandleFromPath
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
static int DeviceHandleFromPath(string path)
{
IntPtr udev = NativeMethods.udev_new();
if (IntPtr.Zero != udev)
{
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"