-
Notifications
You must be signed in to change notification settings - Fork 35
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
Rule: duplicate-rule
#530
Rule: duplicate-rule
#530
Conversation
# Remove whitespace from textual representation of rule and create a hash from the result. | ||
# This provides a decent, and importantly *cheap*, approximation of duplicates. We can then | ||
# parse the text of these suspected duplicate rules to get a more exact result. | ||
rules_hashed := [crypto.md5(regex.replace(text, `\s`, "")) | some text in rules_as_text] |
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.
rules_hashed := [crypto.md5(regex.replace(text, `\s`, "")) | some text in rules_as_text] | |
rules_hashed := [crypto.md5(regex.replace(text, `\s+`, "")) | some text in rules_as_text] |
Might be a tiny bit faster?
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.
Alright :)
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.
Looks great!
As the name implies, flag duplicate rules when found. See the docs included in the PR for more details, including current limitations. This rule should be an aggregate rule, but it was hairy enough to pull off with a single file scope, so I decided to hold off on that for now. This provides value already, so let's ship it and consider looking into making this aggregate later. Fixes #427 Signed-off-by: Anders Eknert <anders@styra.com>
36261f5
to
26d5128
Compare
As the name implies, flag duplicate rules when found. See the docs included in the PR for more details, including current limitations. This rule should be an aggregate rule, but it was hairy enough to pull off with a single file scope, so I decided to hold off on that for now. This provides value already, so let's ship it and consider looking into making this aggregate later. Fixes StyraInc#427 Signed-off-by: Anders Eknert <anders@styra.com>
As the name implies, flag duplicate rules when found. See the docs included in the PR for more details, including current limitations.
This rule should be an aggregate rule, but it was hairy enough to pull off with a single file scope, so I decided to hold off on that for now. This provides value already, so let's ship it and consider looking into making this aggregate later.
Fixes #427