All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.plugins.csharp.S6678.html Maven / Gradle / Ivy

There is a newer version: 10.2.0.105762
Show newest version

Within a message template each named placeholder should be in PascalCase.

Why is this an issue?

Using consistent naming conventions is important for the readability and maintainability of code. In the case of message templates, using PascalCase for named placeholders ensures consistency with structured logging conventions, where each named placeholder is used as a property name in the structured data.

The rule covers the following logging frameworks:

How to fix it

Use PascalCase for named placeholders.

Code examples

Noncompliant code example

logger.LogDebug("User {firstName} logged in", firstName); // Noncompliant

Compliant solution

logger.LogDebug("User {FirstName} logged in", firstName); // Compliant

Resources

Documentation





© 2015 - 2024 Weber Informatics LLC | Privacy Policy