isselab / HAnS

HAnS - Helping Annotate Software. HAnS is an open-source (Apache 2.0) plugin for IntelliJ that helps you annotate software.
Apache License 2.0
6 stars 5 forks source link

Feature naming rules via custom regular expressions #57

Open SvenPeldszus opened 5 months ago

SvenPeldszus commented 5 months ago

Describe the need of your request

Often one wants feature names to follow institution-specific naming schemes to facilitate understandability or automated processing. To ensure that feature names are consistent within a project and follow specific naming rules, it would be beneficial if HAnS allows to define and enforce such rules.

Proposed solution

Add support to enforce feature naming schemes using regular expressions.

Alternatives you've considered

No response

Additional context

Consider a feature model of security features. In such a model, you have different kinds of features such as abstract features for categories of security features, concrete implementations of security features, but also code related to their usages that one might want to annotate. To distinguish these different kinds it would be beneficial to enforce a naming scheme, e.g., as follows:

cat_Security
       cat_Cryptography
              cat_Encryption
                     feat_AES
                            use_send_message
                            use_store_data
                     feat_RSA
                     ...
              cat_Hashing
       cat_Communication

In this example, we would use three different prefixes. In general, arbitrary patterns could be specified and enforced, e.g., by allowing to specify project-specific regular expressions for this purpose. For the example, the constraint could look like the following:

^((cat_)|(feat_)|(use_)).+