CORE-POS/IS4C

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

Summary

Maintainability
A
2 hrs
Test Coverage

Method FindComPort has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
Open

    public static string FindComPort(string search)
    {
        var searcher = new ManagementObjectSearcher(
            "root\\CIMV2",
            "SELECT * FROM Win32_PnPEntity WHERE ClassGuid=\"{4d36e978-e325-11ce-bfc1-08002be10318}\""
Severity: Minor
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/ComPort.cs - About 1 hr 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

Avoid deeply nested control flow statements.
Open

                        if (match.Success) {
                            return match.Value;
                        }
Severity: Major
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/ComPort.cs - About 45 mins to fix

    There are no issues that match your filters.

    Category
    Status