pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs
Method CommonWrite
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
Open
internal void CommonWrite(byte[] buffer, int offset, int count,
Queue<CommonOutputReport> queue,
bool feature, int maxOutputReportLength)
{
Throw.If.OutOfRange(buffer, offset, count);
- 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
Class HidStream
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
[ComVisible(true), Guid("0C263D05-0D58-4c6c-AEA7-EB9E0C5338A2")]
public abstract class HidStream : Stream
{
int _opened, _closed;
volatile int _refCount;
Method CommonWrite
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
internal void CommonWrite(byte[] buffer, int offset, int count,
Queue<CommonOutputReport> queue,
bool feature, int maxOutputReportLength)
{
Throw.If.OutOfRange(buffer, offset, count);
Method CommonRead
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
internal int CommonRead(byte[] buffer, int offset, int count, Queue<byte[]> queue)
{
Throw.If.OutOfRange(buffer, offset, count);
if (count == 0) { return 0; }
Method CommonWrite
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
internal void CommonWrite(byte[] buffer, int offset, int count,
Queue<CommonOutputReport> queue,
bool feature, int maxOutputReportLength)
Avoid deeply nested control flow statements. Open
Open
if (!outputReport.DoneOK) { throw new IOException(); }
Method BeginWrite
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Method BeginRead
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)