Comments (4)
this.logger.LogError( "The tracking number '{TrackingNumber}' for the specified unit with the prefix '{SpecifiedUnitIdPrefix}' for bypassing did not match the expected pattern. ErrorCode: {ErrorCode}", trackingNumber, specifiedUnitIdPrefix, ErrorCodes.BypassUnitTrackingNumberNotMatched);
Will be fixed.
[LoggerMessage(EventId = EventIds.BypassTrackingNumberPrefixUnmatched, Level = LogLevel.Error, Message = "The tracking number '{TrackingNumber}' for the specified unit with the prefix '{SpecifiedUnitIdPrefix}' for bypassing did not match the expected pattern. ErrorCode: {ErrorCode}", )] private partial void LogUnitPrefixDidNotMatch(int trackingNumber, string specifiedUnitIdPrefix, int errorCode);It would be best if the attribute could be kept single line, but if required could also be spread with one parameter per line.
Will be fixed (parameter with string literal must be on its own line).
return new ErrorResult( ErrorCodes.BypassUnitTrackingNumberNotMatched, "The bypass tracking number did not match the expected pattern", $"Could not bypass. The prefix '{specifiedUnitIdPrefix}' of the specified unit associated with the tracking number '{trackingNumber}' did not match the expected pattern. Please verify your input", ProblemPageUrls.UnmatchedUnit);
Will be fixed (same as first case).
from roslynator.
Adding an option to prevent certain lines from being reported as too long is definitely possible.
Could you provide some examples of lines that should be skipped by RCS0056? Thanks.
from roslynator.
Sure.
Structured Logging
These kinds of templates would need an exclusion
(most of these messages are still inline, some of those have already been moved to usage with the LoggerMessageAttribute)
"The tracking number '{TrackingNumber}' for the specified unit with the prefix '{SpecifiedUnitIdPrefix}' for bypassing did not match the expected pattern. ErrorCode: {ErrorCode}",
Full Code
this.logger.LogError(
"The tracking number '{TrackingNumber}' for the specified unit with the prefix '{SpecifiedUnitIdPrefix}' for bypassing did not match the expected pattern. ErrorCode: {ErrorCode}",
trackingNumber,
specifiedUnitIdPrefix,
ErrorCodes.BypassUnitTrackingNumberNotMatched);
with the LoggerMessageAttribute the code would look like this
[LoggerMessage(EventId = EventIds.BypassTrackingNumberPrefixUnmatched, Level = LogLevel.Error, Message = "The tracking number '{TrackingNumber}' for the specified unit with the prefix '{SpecifiedUnitIdPrefix}' for bypassing did not match the expected pattern. ErrorCode: {ErrorCode}", )]
private partial void LogUnitPrefixDidNotMatch(int trackingNumber, string specifiedUnitIdPrefix, int errorCode);
It would be best if the attribute could be kept single line, but if required could also be spread with one parameter per line.
Since all attribute usages are ascendant in the code, they are currently easily excluded with a #pragma warning disable
statement and therefore are not so important to get an exclusion, but would be nice to have
UI Feedback
This is the associated message as an interpolated string which is used for user feedback in the UI, which also should be excludable
$"Could not bypass. The prefix '{specifiedUnitIdPrefix}' of the specified unit associated with the tracking number '{trackingNumber}' did not match the expected pattern. Please verify your input",
Full Code
return new ErrorResult(
ErrorCodes.BypassUnitTrackingNumberNotMatched,
"The bypass tracking number did not match the expected pattern",
$"Could not bypass. The prefix '{specifiedUnitIdPrefix}' of the specified unit associated with the tracking number '{trackingNumber}' did not match the expected pattern. Please verify your input",
ProblemPageUrls.UnmatchedUnit);
I hope these examples are sufficient to clarify my scenario, let me know if you need additional information.
And already thanks for considering
from roslynator.
Perfekt! Thank you for the quick implementation.
...(parameter with string literal must be on its own line)
I already expected this to be a requirement 😜
from roslynator.
Related Issues (20)
- About new packages HOT 4
- Consider disabling `RCS1223` for attributes HOT 2
- RCS1159 should not be reported for WPF routed events HOT 2
- Declare as nullable code fix for CS8600 breaks when casts are involved HOT 1
- Simplify numeric comparison HOT 7
- Consider disabling `RCS0012` for fields HOT 1
- `RCS1019` does not work for `file static` HOT 1
- Collection expressions are not considered "obvious" typing
- `RCS1250` fixer cannot handle collection expressions
- `RCS1250` Applies collection-expression fixer when properties are set.
- RCS1060 doesn't work with file-scoped namespaces HOT 2
- CS8032: An instance of analyzer Roslynator.CSharp.Analysis.UnnecessaryRawStringLiteralAnalyzer cannot be created HOT 2
- RCS1267 - propose wrong fix
- Some analyzers don't work in Rider with severity being set to "suggestion" HOT 1
- RCS1169 not being diffused by roslynator_unity_code_analysis.enabled = true HOT 4
- RCS1077 Crashes with NullReference Exception HOT 2
- Typo in new option key
- Missing documentation HOT 7
- Add performance refactoring for IList Last, First or ElementAt HOT 1
- bug(RCS1077): does not fire when a List has been inherited
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roslynator.