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

NR-359870 fix for the attribute validator crash #340

Merged
merged 4 commits into from
Jan 27, 2025
Merged

Conversation

mbruin-NR
Copy link
Contributor

Moved the attribute validator to utils so it can be static and used anywhere it's needed

Copy link
Contributor

@smalsam-newr smalsam-newr left a comment

Choose a reason for hiding this comment

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

The attribute validator doesn't need to be made static. The appropriate way to do this, if it's going to be the same attribute validator, would be to create a class that conforms to the AttributeValidator protocol

Copy link
Member

@cdillard-NewRelic cdillard-NewRelic left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@cdillard-NewRelic
Copy link
Member

I think this is okay use of static.
If there is concern with making this static I would suggest adding it as a singleton to the BlockAttributeValidator class.

Copy link
Contributor

@smalsam-newr smalsam-newr left a comment

Choose a reason for hiding this comment

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

This is not the way that class is meant to be used.

Copy link
Member

@cdillard-NewRelic cdillard-NewRelic left a comment

Choose a reason for hiding this comment

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

LGTM

smalsam-newr
smalsam-newr previously approved these changes Jan 24, 2025
@@ -71,6 +74,8 @@ - (instancetype) initWithAnalyticsController:(NRMAAnalytics*)analytics
self = [super init];
if (self) {
analyticsParent = analytics;

_attributeValidator = [[NRMAAttributeValidator alloc] init];
Copy link
Contributor

Choose a reason for hiding this comment

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

If you pass something that conforms to the AttributeValidator protocol in as a parameter to this class, then you can replace it for testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the change to move it to be passed in.

…ndled exception, so it can be replaced for testing
@mbruin-NR mbruin-NR merged commit 6b814a2 into develop Jan 27, 2025
11 checks passed
@mbruin-NR mbruin-NR deleted the NR-359870 branch January 27, 2025 20:10
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.

3 participants