CORE-POS/IS4C

View on GitHub
pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs

Summary

Maintainability
C
1 day
Test Coverage

Method CommonWrite has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
Open

        internal void CommonWrite(byte[] buffer, int offset, int count,
                                  Queue<CommonOutputReport> queue,
                                  bool feature, int maxOutputReportLength)
        {
            Throw.If.OutOfRange(buffer, offset, count);
Severity: Minor
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs - About 2 hrs to fix

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

    [ComVisible(true), Guid("0C263D05-0D58-4c6c-AEA7-EB9E0C5338A2")]
    public abstract class HidStream : Stream
    {
        int _opened, _closed;
        volatile int _refCount;
Severity: Minor
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs - About 2 hrs to fix

    Method CommonWrite has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            internal void CommonWrite(byte[] buffer, int offset, int count,
                                      Queue<CommonOutputReport> queue,
                                      bool feature, int maxOutputReportLength)
            {
                Throw.If.OutOfRange(buffer, offset, count);
    Severity: Minor
    Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs - About 1 hr to fix

      Method CommonRead has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              internal int CommonRead(byte[] buffer, int offset, int count, Queue<byte[]> queue)
              {
                  Throw.If.OutOfRange(buffer, offset, count);
                  if (count == 0) { return 0; }
      
      
      Severity: Minor
      Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs - About 1 hr to fix

        Method CommonWrite has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                internal void CommonWrite(byte[] buffer, int offset, int count,
                                          Queue<CommonOutputReport> queue,
                                          bool feature, int maxOutputReportLength)
        Severity: Minor
        Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                              if (!outputReport.DoneOK) { throw new IOException(); }
          Severity: Major
          Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs - About 45 mins to fix

            Method BeginWrite has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
            Severity: Minor
            Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs - About 35 mins to fix

              Method BeginRead has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
              Severity: Minor
              Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/HidSharp/HidStream.cs - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status