CORE-POS/IS4C

View on GitHub
pos/is4c-nf/scale-drivers/drivers/NewMagellan/Newtonsoft.Json/Utilities/DateTimeParser.cs

Summary

Maintainability
C
1 day
Test Coverage

Method ParseZone has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
Open

        private bool ParseZone(int start)
        {
            if (start < _length)
            {
                char ch = _text[start];

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 ParseZone has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        private bool ParseZone(int start)
        {
            if (start < _length)
            {
                char ch = _text[start];

    Method ParseTime has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            private bool ParseTime(ref int start)
            {
                if (!(Parse2Digit(start, out Hour)
                      && Hour < 24
                      && ParseChar(start + LzHH, ':')

      Consider simplifying this complex logical expression.
      Open

                  if (!(Parse2Digit(start, out Hour)
                        && Hour < 24
                        && ParseChar(start + LzHH, ':')
                        && Parse2Digit(start + LzHH_, out Minute)
                        && Minute < 60

        Consider simplifying this complex logical expression.
        Open

                        if (0 <= digit1 && digit1 < 10
                            && 0 <= digit2 && digit2 < 10
                            && 0 <= digit3 && digit3 < 10
                            && 0 <= digit4 && digit4 < 10)
                        {

          There are no issues that match your filters.

          Category
          Status