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 a regex style pattern to the enum-name-style #2210

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sconwayaus
Copy link
Contributor

Adding regex to the enum-name-style rule, part of issue #2074

"and end with '_t' or '_e'.",
"Checks that enum type names follow a naming convention defined by "
"a RE2 regular expression.\n"
"Example common regex patterns:\n"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of repeating the same examples in various places using regexps, how about we add a little section in the lint README.md with regexp examples and just add a link here ?

(also here, the default regex, the one with the trailing _e or _t is not even mentioned)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem.

configuration, {{"style_regex", SetRegex(&style_regex_)}});
if (!s.ok()) return s;

violation_message_ =
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am wondering: instead of having a validation_message_ member that we most likely never use, yet allocate and prepare should we maybe have a std::string CreateValidationMessage() {} that creates it on-the-fly if needed in the actual valdation ? It also would mean that we don't have to duplicate the code creating it in the constructor and in the Configure() method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem.

@sconwayaus sconwayaus force-pushed the enum_name_style_regex branch 4 times, most recently from be5d5cf to 9c50c4b Compare July 10, 2024 12:31
Cleaned up the violation message (remove code duplication).
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