-
Notifications
You must be signed in to change notification settings - Fork 17
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
Closing #141 - var
guidance
#162
Conversation
docs/Guidelines(8th Edition).xml
Outdated
@@ -246,6 +246,8 @@ | |||
<guideline key="Ch14_6baa967" severity="DO" section="Coding" subsection="Types">DO use System.EventArgs or a type that derives from System.EventArgs for a TEventArgs type.</guideline> | |||
<guideline key="Ch03_f566c99" severity="AVOID" section="Coding" subsection="Types">AVOID using implicitly typed local variables unless the data type of the assigned value is obvious.</guideline> | |||
<guideline key="Ch14_3e1089d" severity="CONSIDER" section="Coding" subsection="Types">CONSIDER using System.EventHandler<T> instead of manually creating new delegate types for event handlers unless the parameter names of a custom type offer significant clarification.</guideline> | |||
<guideline severity="CONSIDER" section="CODING" subsection="Variables">CONSIDER using var any time that the initialization of the variable clearly shows what the variable will contain.</guideline> |
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.
Without a key, XMLtoMD.GuidelineXmlToMD.Guidelines.GetHashCode
throws an error because it expects its Key
property to be non-null. @Keboo what do you think is a better solution: refactor GetHashCode
on Guideline.cs
or add keys to these new XML lines?
See:
return Key.GetHashCode(); |
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.
O that is not good. I missed that previously. I would expect the Guidline to use all of its members to determine equality/hashcodes.
An even better solution would be to just make it a record type.
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 will investigate switching to a record type. I haven't been working with C# lately, so I have some reading up to do on how record types work. Fortunately, I know some people that did a meetup on the topic. 😉
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.
public record Guideline(string Text, string Severity, string Section, string Subsection, string? Key IList<string>? Comments);
should probably do it
…into add-var-guidance
Fixes #141