AEP-0216 Linter Rules
States
States
This rule enforces that all lifecycle state enums are nested within their resource, as recommended in AEP-216.
Details
This rule iterates over enumerations and looks for enums with a name of
FooState
where a corresponding Foo
message exists in the same file. If it
finds such a case, it recommends that the enum be nested within the message.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the enum. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
States
States
This rule requires that all lifecycle state fields whose names end with State
are marked as OUTPUT_ONLY
, as mandated in AEP-216.
Details
This rule iterates over message fields that have an enum
type, and the type
name ends with State
. Each field should have the annotation
[(google.api.field_behavior) = OUTPUT_ONLY]
.
Note that the field name is ignored for the purposes of this rule.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the field Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
States
States
This rule enforces that all lifecycle state enums are called State
rather
than Status
, as mandated in AEP-216.
Details
This rule iterates over enumerations and looks for enums with a name of
Status
or ending in Status
, and suggests the use of State
instead.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the enum value. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Value synonyms
Value synonyms
This rule enforces the use of state values enumerated in AEP-216 over common synonyms.
Details
This rule iterates over enumerations that end in State
and looks for enum
values that are common synonyms or alternate spellings of the states listed at
the end of AEP-216, and suggests the use of the canonical value instead.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the enum value. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.