-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add BuildServiceProvider analyzer rule #192
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #192 +/- ##
==========================================
+ Coverage 74.42% 74.53% +0.11%
==========================================
Files 67 68 +1
Lines 2428 2486 +58
Branches 290 298 +8
==========================================
+ Hits 1807 1853 +46
- Misses 551 558 +7
- Partials 70 75 +5 ☔ View full report in Codecov by Sentry. |
DiagnosticSeverity.Error, | ||
AnalyzerConstants.EnabledByDefault, | ||
Description, | ||
"https://github.com/agoda-com/AgodaAnalyzers/issues/190", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets do the documentation in the doc repo, not in issues, this will allow us to be more accurate, issues are chatty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did another MR to update docs, i think replicate this.
Ideally these should be in our standards, but things like this is more of a bug than a standard, so i think we need a new ay to store like this
When you make documentation, can you:
Sonar has some good examples https://rules.sonarsource.com/csharp/type/Code%20Smell/RSPEC-1163/ I've been trying my best like this https://github.com/agoda-com/agoda-kraft/blob/main/doc/AG001.md We probably need some sort of template But look at it like this, you are a junior engineer, you see this error for the first tie in your IDE, what's the documentation you need to fix your problem? and save you from either
|
{ | ||
var invocationExpr = (InvocationExpressionSyntax)context.Node; | ||
|
||
// Check if it's a member access (e.g., something.BuildServiceProvider()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these comments add value? Personally I think that the code if ( something is MemberAccessExpressionSyntax)
communicates well that we're checking if something is a member access (literally uses the same words).
DiagnosticSeverity.Error, | ||
AnalyzerConstants.EnabledByDefault, | ||
Description, | ||
"https://github.com/agoda-com/AgodaAnalyzers/issues/190", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an interesting one, should we add to docs some examples for typical use-cases and how to solve them without BuildServiceProvider
? Where I've seen this used most of the time is during constructing services that have their own dependencies, like in the registration of a lot of the thick-clients for agoda services. I assume the right way would be to just pass an IServiceProvider along, rather than building it?
(Ahh, I guess Joel was asking for the same, just see it in the comments after submitting, didn't notice sorry)
* Update AG0041LogTemplateAnalyzer.cs * Create AG0041.md
Closes #190