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

Enhancement request: Implement regular expression matching for flexibility to support a variety of coding standards. #66

Closed
DavidotNet opened this issue Jan 12, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@DavidotNet
Copy link

Feature request. Enhance the settings configuration to accept regular expression (RegEx) strings, and the enhance the identifier validation logic to apply RegEx matching; e.g. PREFIX_LOCAL_VARIABLE_NAME = "^(c_|v_|h_|k_|i_|n_|aa_|nt_|va_|cur_|rec_)"

Usage of RegEx is beneficial in that it would afford maximum customization flexibility for validation of a variety of custom coding standards.

Backward compatibility: Implement a new Boolean setting; USE_TRIVADIS_DEFAULTS and replace the Trivadis default values with corresponding RegEx strings.

Instead of using Prefix.StartsWith(…) or Suffix.EndsWith(…), extract the corresponding value from the identifier and apply a RegEx matcher using the setting value of the identifier's context usage.

New behavior: if a setting is empty, skip validation for that identifier type. There are no defaults when USE_TRIVADIS_DEFAULTS = false.

Additional settings are requested -
PREFIX_COLLECTION_NAME
SUFFIX_PARAMETER_NAME
PREFIX_NON_CURSOR_PARAMETER_NAME

@PhilippSalvisberg
Copy link
Collaborator

Thank you for your enhancement request.

It's a good idea to use regular expressions to check the naming conventions of objects. However, instead of defining regular expressions for prefixes and suffixes, I think it might be more flexible and easier to define a regex per type. For example one regular expression for

  • local variables
  • input parameters
  • output parameters
  • input/output parameters
  • etc.

In this case, I would not care about backward compatibility. The default would match the Trivadis guidelines and can be amended through configuration for others.

This will also have an impact on the guideline titles and texts. Even the numbering might be affected since there is no need for a dedicated guideline for the prefix and suffix of a type (record type and array type).

@PhilippSalvisberg PhilippSalvisberg self-assigned this Jan 15, 2024
@PhilippSalvisberg PhilippSalvisberg added the enhancement New feature or request label Jan 15, 2024
@PhilippSalvisberg
Copy link
Collaborator

related to DevOps ticket 65421.

@PhilippSalvisberg PhilippSalvisberg added this to the v4.5.0 milestone Jan 16, 2024
@PhilippSalvisberg
Copy link
Collaborator

closed via f5e2f77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants