github.com/googleapis/api-linter@v1.65.2/docs/rules/0141/count-suffix.md (about) 1 --- 2 rule: 3 aip: 141 4 name: [core, '0141', count-suffix] 5 summary: Quantities should use a `_count` suffix. 6 permalink: /141/count-suffix 7 redirect_from: 8 - /0141/count-suffix 9 --- 10 11 # Count suffix 12 13 This rule tries to enforce that discrete quantities have consistent field names 14 ending in `_count`, as mandated in [AIP-141][]. 15 16 ## Details 17 18 This rule scans all fields and complains if it sees a `num_` prefix, and 19 suggests a `_count` suffix instead. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 message Book { 28 string name = 1; 29 int32 num_pages = 2; // Should be `page_count`. 30 } 31 ``` 32 33 **Correct** code for this rule: 34 35 ```proto 36 // Correct. 37 message Book { 38 string name = 1; 39 int32 page_count = 2; 40 } 41 ``` 42 43 ## Disabling 44 45 If you need to violate this rule, use a leading comment above the method. 46 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 47 48 ```proto 49 // (-- api-linter: core::0141::count-suffix=disabled 50 // aip.dev/not-precedent: We need to do this because reasons. --) 51 message Book { 52 string name = 1; 53 int32 num_pages = 2; 54 } 55 ``` 56 57 If you need to violate this rule for an entire file, place the comment at the 58 top of the file. 59 60 [aip-141]: https://aip.dev/141 61 [aip.dev/not-precedent]: https://aip.dev/not-precedent