Skip to content

feat(config): Add unknown ruletype - #1741

Merged
TBS1996 merged 5 commits into
masterfrom
feat/ruletype
Feb 1, 2023
Merged

TBS1996 merged 5 commits into
masterfrom
feat/ruletype

Conversation

@TBS1996

@TBS1996 TBS1996 commented Jan 12, 2023 •

Copy link
Copy Markdown
Contributor

Adds a new enum variant to ruletype for forward-compatibility

#1639

#skip-changelog

@TBS1996
TBS1996 requested a review from jjbayer January 16, 2023 14:46
@TBS1996
TBS1996 marked this pull request as ready for review January 16, 2023 14:49
@TBS1996
TBS1996 requested a review from a team January 16, 2023 14:49
Comment thread relay-general/src/pii/regexes.rs Outdated
RuleType::UsSsn => smallvec![(v, &*US_SSN_REGEX, ReplaceBehavior::replace_match())],
RuleType::Userpath => smallvec![(v, &*PATH_REGEX, ReplaceBehavior::replace_group(1))],

RuleType::Unknown(_) => smallvec![],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think there is one more match statement we need to change:

collect_rules: Skip unknown rules instead of inserting them:

_ => {
rules.insert(rule);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Let's put RuleType::Unknown(_) into the same match branch as RuleType::Alias and RuleType::Multiple. The comment "these ought to have been resolved in CompiledConfig" apply to all of them.

@jjbayer jjbayer mentioned this pull request Jan 17, 2023
2 of 5 tasks
@TBS1996
TBS1996 requested a review from jjbayer January 31, 2023 14:59

@jjbayer jjbayer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See single nitpick, apart from that this looks good to go!

Comment thread relay-general/src/pii/regexes.rs Outdated
RuleType::UsSsn => smallvec![(v, &*US_SSN_REGEX, ReplaceBehavior::replace_match())],
RuleType::Userpath => smallvec![(v, &*PATH_REGEX, ReplaceBehavior::replace_group(1))],

RuleType::Unknown(_) => smallvec![],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Let's put RuleType::Unknown(_) into the same match branch as RuleType::Alias and RuleType::Multiple. The comment "these ought to have been resolved in CompiledConfig" apply to all of them.

@TBS1996
TBS1996 enabled auto-merge (squash) February 1, 2023 12:40
@TBS1996
TBS1996 merged commit 0151447 into master Feb 1, 2023
@TBS1996
TBS1996 deleted the feat/ruletype branch February 1, 2023 12:55
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.

2 participants