
org.sonar.plugins.csharp.S6669.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonarlint-omnisharp-plugin Show documentation
Show all versions of sonarlint-omnisharp-plugin Show documentation
Code Analyzer based on Omnisharp
Why is this an issue?
Sharing some naming conventions is a key point to make it possible for a team to efficiently collaborate. This rule checks that the logger field or
property name matches a provided regular expression.
The rule supports the most popular logging frameworks:
- Nuget package - Microsoft.Extensions.Logging
- Nuget package - Serilog
- Nuget package - Castle.Core
- Nuget package - NLog
- Nuget package - log4net
How to fix it
Update the name of the field or property to follow the configured naming convention. By default, the following names are considered compliant:
-
{logger}
-
{_logger}
-
{Logger}
-
{_Logger}
-
{log}
-
{_log}
Noncompliant code example
private readonly ILogger myLogger; // Noncompliant
public ILogger MyLogger { get; set; } // Noncompliant
Compliant solution
private readonly ILogger logger; // Compliant
public ILogger Logger { get; set; } // Compliant
Resources
Documentation
- Microsoft Learn - Coding conventions
© 2015 - 2025 Weber Informatics LLC | Privacy Policy