Skip to content

readability-identifier-naming does not allow overriding a prefix with an empty prefix #56358

@jbytheway

Description

@jbytheway

I wish to enforce a particular prefix on global variables which are not constants.

I would expect to be able to do this via the following options to readability-identifier-naming:

  - key: readability-identifier-naming.GlobalConstantPrefix
    value: ''
  - key: readability-identifier-naming.GlobalVariablePrefix
    value: g_

However, it seems that when GlobalConstantPrefix is set to the empty string, it is treated as if it is not set at all. The consequence is that all global variables including constants are forced to use the prefix.

I also tried setting the GlobalConstantPrefix to null, but this seems to be impossible. Using either ~ or null simply interprets the value as the literal string ~ or null, which is not intended.

It's not clear to me whether YAML distinguishes null from the empty string at all. If it doesn't then this issue is understandable. It would still be nice to have some way to express this requirement. Perhaps some character which is not valid for use in identifiers could be assigned the meaning of 'no prefix required' and can be used for overrides like this. The character ~ seems like the obvious choice, since that supposedly represents null in YAML sometimes.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions