Skip to content
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 ImplementingType to RuleInfo object #1250

Merged

Conversation

JamesWTruher
Copy link
Member

PR Summary

This will enable easier creation of settings file validation and settings file template creation.
Navigating to the actual implementation of the rule is quite difficult, by providing the implementing type of the rule, this becomes much easier. This is similar to how CmdletInfo works in PowerShell where there is an ImplementingType property on the CmdletInfo object.

This will enable a couple of things; first, we'll be able to create validation of settings file without translating the rule name to the type that implements (so you can very easily retrieve the configurable properties). Second, it will also be possible to write tools to create templates for settings.

PR Checklist

This will enable easier creation of settings file validation and settings file template creation.
Copy link
Collaborator

@bergmeister bergmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from a small comment about a property, looks good to me, thanks.

/// <summary>
/// ImplementingType : The type which implements the rule.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the CA rule is right to call this out. C# has auto-properties now that can simplify this property to public Type { get; } whereby the private setter is included by default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah - I didn't want to change them all, so I just followed the previous example for consistency. I'm certainly happy to change all of them.

@JamesWTruher JamesWTruher merged commit a7dbee1 into PowerShell:development Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants