Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLogMessageParameterList - Reduce code complexity for IsValidParameterList #334

Merged
merged 1 commit into from
Sep 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/NLog.Extensions.Logging/Logging/NLogMessageParameterList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,14 @@ private static bool IsValidParameterList(IReadOnlyList<KeyValuePair<string, obje
char firstChar = parameterName[0];
if (firstChar >= '0' && firstChar <= '9')
{
if (!isPositional && i != 0)
isMixedPositional = true;
if (!isPositional)
isMixedPositional = i != 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The semantics changed here. Is that on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the result is the same. But one less condition.

isPositional = true;
}
else
{
if (isPositional)
{
isMixedPositional = true;
}

if (GetCaptureType(firstChar) != CaptureType.Normal)
{
hasMessageTemplateCapture = true;
}
isMixedPositional = isPositional;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the result is the same. But less conditions.

hasMessageTemplateCapture |= GetCaptureType(firstChar) != CaptureType.Normal;
}
}

Expand Down