== Why is this an issue?

Sharing some naming conventions enables teams to collaborate more efficiently.
This rule checks that all `union` names and `union` type alias names match a provided regular expression.


=== Noncompliant code example

Using the default regular expression `^[A-Z][a-zA-Z0-9]*$`:

[source,cpp,diff-id=1,diff-type=noncompliant]
----
union my_union {
    int one;
    int two;
};

using my_other_union = union {
    int one;
    int two;
};
----


=== Compliant solution

[source,cpp,diff-id=1,diff-type=compliant]
----
union MyUnion {
    int one;
    int two;
};

using MyOtherUnion = union {
    int one;
    int two;
};
----


=== Exceptions

The rule ignores anonymous unions that are not type aliased.

[source,cpp]
----
// Compliant by exception
union {
    int a;
    bool b;
} u;
----


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Rename this union to match the regular expression ${format}


=== Parameters

.format
****
_STRING_

----
^[A-Z][a-zA-Z0-9]*$
----

Regular expression union names should match.
****


endif::env-github,rspecator-view[]
