Edwin Kempin | 9d486ed | 2020-09-15 15:05:23 +0200 | [diff] [blame] | 1 | # find-owners Backend |
| 2 | |
| 3 | The `find-owners` backend supports the syntax of the |
| 4 | [find-owners](https://gerrit-review.googlesource.com/admin/repos/plugins/find-owners) |
| 5 | plugin (with some minor extensions). It is the backend that is used by default |
| 6 | if no other backend is explicitly [configured](config.html#codeOwnersBackend) |
| 7 | for a project or branch. |
| 8 | |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 9 | ## <a id="codeOwnerConfiguration">Code owner configuration |
Edwin Kempin | 9d486ed | 2020-09-15 15:05:23 +0200 | [diff] [blame] | 10 | |
| 11 | Code owners are defined in `OWNERS` files which are stored in the source tree. |
Edwin Kempin | fd42aa5 | 2021-06-24 17:26:26 +0200 | [diff] [blame] | 12 | |
Edwin Kempin | 9d486ed | 2020-09-15 15:05:23 +0200 | [diff] [blame] | 13 | The code owners that are defined in an `OWNERS` file apply to the directory that |
| 14 | contains the `OWNERS` file, and all its subdirectories (except if a subdirectory |
| 15 | contains an `OWNERS` file that disables the inheritance of code owners from the |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 16 | parent directories via the [set noparent](#setNoparent) keyword). |
Edwin Kempin | 9d486ed | 2020-09-15 15:05:23 +0200 | [diff] [blame] | 17 | |
Edwin Kempin | fd42aa5 | 2021-06-24 17:26:26 +0200 | [diff] [blame] | 18 | **NOTE:** It is also possible to define code owners in `<prefix>_OWNERS` or |
| 19 | `OWNERS_<extension>` files that can be imported into `OWNERS` files (further |
| 20 | details about code owner config files are described |
| 21 | [here](backends.html#codeOwnerConfigFiles)). |
| 22 | |
Edwin Kempin | 9351607 | 2022-11-02 12:51:34 +0100 | [diff] [blame] | 23 | **NOTE:** Tools should never parse `OWNERS` files on their own, but instead |
| 24 | always use the [REST API](rest-api.html) to access code owner information. |
| 25 | |
| 26 | Parsing `OWNERS` files is highly discouraged because: |
| 27 | |
| 28 | * it's hard for tools to implement the parsing of `OWNERS` files in a way that |
| 29 | is consistent with how Gerrit parses them |
| 30 | * reimplementing the parsing logic outside of Gerrit is a lot of effort that can |
| 31 | be saved by using the REST API and letting Gerrit do the parsing |
| 32 | * parsing `OWNERS` files outside of Gerrit is likely less efficient since the |
| 33 | parser likely needs to reach out to Gerrit to fetch additional input (e.g. if |
| 34 | `OWNERS` files from other branches or repositories are imported) |
| 35 | * the format of `OWNERS` files may change (e.g. by the addition of new features) |
| 36 | which could break parsers outside of Gerrit |
| 37 | |
Edwin Kempin | fd42aa5 | 2021-06-24 17:26:26 +0200 | [diff] [blame] | 38 | ### <a id="defaultCodeOwnerConfiguration">Default code owners |
Edwin Kempin | 921ddee | 2020-11-06 16:02:48 +0100 | [diff] [blame] | 39 | Default code owners that apply to all branches can be defined in an `OWNERS` |
| 40 | file in the root directory of the `refs/meta/config` branch. This `OWNERS` file |
| 41 | is the parent of the root `OWNERS` files in all branches. This means if a root |
| 42 | `OWNERS` file disables the inheritance of code owners from the parent |
| 43 | directories via the [set noparent](#setNoparent) keyword the `OWNERS` file in |
| 44 | the `refs/meta/config` branch is ignored. Default code owners are not inherited |
| 45 | from parent projects. If code owners should be defined for child projects this |
| 46 | can be done by setting [global code |
| 47 | owners](config.html#codeOwnersGlobalCodeOwner). |
| 48 | |
Edwin Kempin | fd42aa5 | 2021-06-24 17:26:26 +0200 | [diff] [blame] | 49 | ### <a id="codeOwnerConfigFileExtension">Using a file extension for OWNERS files |
| 50 | It's possible that projects have a [file |
| 51 | extension](config.html#codeOwnersFileExtension) for code owner config files |
| 52 | configured. In this case the code owners are defined in |
| 53 | `OWNERS.<file-extension>` files and `OWNERS` files are ignored. Further details |
| 54 | about this are described [here](backends.html#codeOwnerConfigFiles). |
Edwin Kempin | 9d486ed | 2020-09-15 15:05:23 +0200 | [diff] [blame] | 55 | |
Edwin Kempin | 61a7259 | 2020-09-21 12:28:47 +0200 | [diff] [blame] | 56 | ## <a id="cookbook">Cookbook |
| 57 | |
| 58 | A cookbook with examples of `OWNERS` files for various use cases can be found |
| 59 | [here](backend-find-owners-cookbook.html). |
| 60 | |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 61 | ## <a id="syntax">Syntax |
| 62 | |
| 63 | An `OWNERS` file is a set of lines which are order-independent. Each line can be |
| 64 | |
| 65 | * a [file-level rule](#fileLevelRules) |
| 66 | * an [access grant](#accessGrants), possibly with a |
| 67 | [restriction prefix](#restrictionPrefixes) |
| 68 | * a [comment](#comments) |
| 69 | |
Edwin Kempin | 6ad792c | 2021-07-26 12:33:08 +0200 | [diff] [blame] | 70 | **NOTE:** By default the `find-owners` backend uses |
| 71 | [FIND_OWNERS_GLOB's](path-expressions.html) as path expressions, but it's |
| 72 | possible that a different path expression syntax is |
| 73 | [configured](config.html#pluginCodeOwnersPathExpressions). All examples on this |
| 74 | page assume that `FIND_OWNERS_GLOB`'s are used as path expressions. |
| 75 | |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 76 | ### <a id="fileLevelRules">File-level rules |
| 77 | |
| 78 | File-level rules apply to the entire `OWNERS` file and should not be repeated. |
| 79 | |
| 80 | #### <a id="setNoparent">set noparent |
| 81 | |
| 82 | By default, a directory inherits the code owners from its parent directory. e.g. |
| 83 | `/path/to/OWNERS` inherits from `/path/OWNERS`. Code owners won't be inherited |
| 84 | from parent directories if the `set noparent` keyword is added to an `OWNERS` |
| 85 | file. |
| 86 | |
| 87 | For example, the following `OWNERS` file ignores code owners from the parent |
| 88 | directories and defines some local code owners: |
| 89 | |
| 90 | ``` |
| 91 | set noparent |
| 92 | |
| 93 | [email protected] |
| 94 | [email protected] |
| 95 | ``` |
| 96 | |
| 97 | ### <a id="accessGrants">Access grants |
| 98 | |
| 99 | Access grants assign code ownerships to users. |
| 100 | |
| 101 | #### <a id="userEmails">user emails |
| 102 | |
| 103 | In a typical `OWNERS` file, many lines are user emails. These user emails grant |
| 104 | code ownership to the users that own these emails in Gerrit. |
| 105 | |
| 106 | For example, the following `OWNERS` file lists a few different users who are |
| 107 | code owners: |
| 108 | |
| 109 | ``` |
| 110 | [email protected] |
| 111 | [email protected] |
| 112 | [email protected] |
| 113 | ``` |
| 114 | \ |
| 115 | The order of the user emails is not important and doesn't have any effect, but |
| 116 | for consistency an alphabetical order is recommended. |
| 117 | |
| 118 | User emails that are added to `OWNERS` files must be resolvable in Gerrit. This |
Edwin Kempin | a9eb47c | 2021-01-07 11:36:08 +0100 | [diff] [blame] | 119 | means: |
| 120 | |
| 121 | * there must be an active Gerrit account that has this email assigned, |
| 122 | which is only the case if the user logged in at least once into the Gerrit |
| 123 | WebUI (or if an administrator registered the user programatically) |
| 124 | * the email is not ambiguous (the email belongs to exactly one active Gerrit |
| 125 | account) |
| 126 | * the email has an allowed email domain (see [allowed email domain |
| 127 | configuration](config.html#pluginCodeOwnersAllowedEmailDomain)). |
| 128 | |
| 129 | ##### <a id="nonResolvableCodeOwnersAreIgnored"> |
| 130 | **NOTE:** Non-resolvable code owners in submitted code owner configuration files |
| 131 | are ignored. |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 132 | |
| 133 | **NOTE:** In Gerrit the visibility of users is controlled via the |
| 134 | [accounts.visibility](../../../Documentation/config-gerrit.html#accounts.visibility) |
| 135 | configuration. This means not every user may be able to see every other user. |
| 136 | For code owners this means: |
| 137 | |
| 138 | * you can only add users as code owner that are visible to you |
| 139 | * by adding a user as code owner you expose the existence of this user to |
| 140 | everyone who can read the `OWNERS` file |
| 141 | * the code owner suggestion only suggests code owners that are visible to the |
| 142 | calling user, this means if the `OWNERS` file contains code owners that are |
| 143 | not visible to the calling user, they are omitted from the suggestion |
| 144 | * code owners which are referenced by secondary email cannot be resolved for |
| 145 | most users, this is because secondary emails of users are only visible to |
| 146 | users that have the |
| 147 | [Modify Account](../../../Documentation/access-control.html#capability_modifyAccount) |
| 148 | global capability assigned in Gerrit, which is normally only granted to |
| 149 | administrators |
| 150 | |
| 151 | **NOTE:** Via configuration it is possible to |
| 152 | [limit the email domains](config.html#pluginCodeOwnersAllowedEmailDomain) that |
| 153 | are allowed for code owners. User emails that have an email domain that is not |
| 154 | allowed cannot be added as code owner, and are ignored if they exist. |
| 155 | |
| 156 | #### <a id="allUsers">All users |
| 157 | |
| 158 | Using '*' as [user email](#userEmails) assigns the code ownership to all |
| 159 | registered users, which effectively exempts the directory (or the matches files |
| 160 | if used in combination with a [per-file](#perFile) rule) from requiring code |
| 161 | owner approvals on submit (this is because a code owner approval from the |
| 162 | uploader is always implicit if the uploader is a code owner). |
| 163 | |
| 164 | #### <a id="fileKeyword">file keyword |
| 165 | |
| 166 | A `file:<path-to-owners-file>` line includes rules from another `OWNERS` file. |
| 167 | The path may be either a relative path (e.g. `../sibling/OWNERS`) or an absolute |
| 168 | path (e.g. `/build/OWNERS`). The specified path must include the name of the |
| 169 | referenced code owner config file (e.g. `OWNERS`). |
| 170 | |
| 171 | ``` |
| 172 | file:/build/OWNERS |
| 173 | [email protected] |
| 174 | [email protected] |
| 175 | ``` |
| 176 | \ |
| 177 | Many projects prefer to use the relative form for nearby `OWNERS` files. |
| 178 | Absolute paths are recommended for distant paths, but also to make it easier to |
| 179 | copy or integrate the line between multiple `OWNERS` files. |
| 180 | |
Edwin Kempin | fd42aa5 | 2021-06-24 17:26:26 +0200 | [diff] [blame] | 181 | The file that is referenced by the `file` keyword must be a [code owner config |
| 182 | file](backends.html#codeOwnerConfigFiles). It's not possible to import arbitrary |
| 183 | files. |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 184 | |
Edwin Kempin | 515aec0 | 2022-02-11 15:26:27 +0100 | [diff] [blame] | 185 | ##### <a id="referenceCodeOwnerConfigFilesFromOtherProjects"> |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 186 | It's also possible to reference code owner config files from other projects or |
| 187 | branches (only within the same host): |
| 188 | |
| 189 | * `file:<project>:<path-to-owners-file>`: |
| 190 | Loads the `<path-to-owners-file>` code owner config file from the specified |
| 191 | project. The code owner config file is loaded from the same branch that also |
| 192 | contains the importing `OWNERS` file (e.g. if the importing `OWNERS` file is |
| 193 | in the `master` branch then `<path-to-owners-file>` will be imported from the |
| 194 | `master` branch of the specified project. Example: |
| 195 | `file:foo/bar/baz:/path/to/OWNERS` |
| 196 | * `file:<project>:<branch>:<path-to-owners-file>`: |
| 197 | Loads the `<path-to-owners-file>` code owner config file from the specified |
| 198 | branch of the specified project. The branch can be specified as full ref name |
| 199 | (e.g. `refs/heads/master`) or as short branch name (e.g. `master`). Example: |
| 200 | `file:foo/bar/baz:master:/path/to/OWNERS` |
| 201 | |
| 202 | If referenced `OWNERS` files do not exists, they are silently ignored when code |
| 203 | owners are resolved, but trying to add references to non-existing `OWNERS` file |
Edwin Kempin | d45c8c4 | 2021-08-30 08:59:05 +0200 | [diff] [blame] | 204 | will be rejected on upload/submit. Being ignored means that the `@PLUGIN@` |
| 205 | doesn't bail out with an error when code owners are resolved, but the import of |
| 206 | non-resolvable `OWNERS` files [prevents fallback code owners from being |
| 207 | applied](config.html#pluginCodeOwnersFallbackCodeOwners). The reason for this is |
| 208 | that if there is an unresolved import, it is assumed that it was intended to |
| 209 | define code owners, e.g. stricter code owners than the fallback code owners, and |
| 210 | hence the fallback code owners should not be applied. |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 211 | |
| 212 | When referencing an external `OWNERS` file via the `file` keyword, only |
Edwin Kempin | 190d67a | 2021-09-27 09:54:20 +0200 | [diff] [blame] | 213 | non-restricted [access grants](#accessGrants) are imported. If they contain |
| 214 | imports (via the `file` or [include](#includeKeyword) keyword) they are |
| 215 | recursively resolved. This means for the referenced `OWNERS` files the following |
| 216 | things are ignored and not pulled in: |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 217 | |
Edwin Kempin | 190d67a | 2021-09-27 09:54:20 +0200 | [diff] [blame] | 218 | 1. `per-file` rules |
| 219 | 2. any [set noparent](#setNoparent) line |
| 220 | 3. `OWNERS` files in parent directories |
| 221 | |
| 222 | To also import `per-file` rules and any [set noparent](#setNoparent) line (1. + |
| 223 | 2.) use the [include](#includeKeyword) keyword instead. |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 224 | |
| 225 | #### <a id="includeKeyword">include keyword |
| 226 | |
| 227 | An `include <path-to-owners-file>` line includes rules from another `OWNERS` |
| 228 | file, similar to the [file](#fileKeyword) keyword. The only difference is that |
| 229 | using the `include` keyword also imports `per-file` rules and any |
| 230 | [set noparent](#setNoparent) line from the referenced `OWNERS` file. |
| 231 | |
| 232 | **NOTE:** In contrast to the [file](#fileKeyword) keyword, the `include` keyword |
| 233 | is used without any ':' between the keyword and the file path (e.g. |
| 234 | `include /path/to/OWNERS`). |
| 235 | |
Edwin Kempin | 61a7259 | 2020-09-21 12:28:47 +0200 | [diff] [blame] | 236 | **NOTE:** Using the include keyword in combination with a [per-file](#perFile) |
| 237 | rule is not possible. |
| 238 | |
Edwin Kempin | 36a42ea | 2020-09-18 12:19:10 +0200 | [diff] [blame] | 239 | #### <a id="groups">Groups |
| 240 | |
| 241 | Groups are not supported in `OWNERS` files and assigning code ownership to them |
| 242 | is not possible. |
| 243 | |
| 244 | Instead of using a group you may define a set of users in an `OWNERS` file with |
| 245 | a prefix (`<prefix>_OWNERS`) or an extension (`OWNERS_<extension>`) and then |
| 246 | import it into other `OWNERS` files via the [file](#fileKeyword) keyword or the |
| 247 | [include](#includeKeyword) keyword. By using a prefix or extension for the |
| 248 | `OWNERS` file it is only interpreted when it is imported into another `OWNERS` |
| 249 | file, but otherwise it has no effect. |
| 250 | |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 251 | ### <a id="restrictionPrefixes">Restriction Prefixes |
| 252 | |
| 253 | All restriction prefixes should be put at the start of a line, before an |
| 254 | [access grant](#accessGrants). |
| 255 | |
| 256 | #### <a id="perFile">per-file |
| 257 | |
| 258 | A `per-file` line restricts the given access grant to only apply to a subset of |
| 259 | files in the directory: |
| 260 | |
| 261 | ``` |
| 262 | per-file <path-exp-1,path-exp-2,...>=<access-grant> |
| 263 | ``` |
| 264 | \ |
| 265 | The access grant applies only to the files that are matched by the given path |
Edwin Kempin | 46b9c3a | 2020-09-16 13:10:34 +0200 | [diff] [blame] | 266 | expressions. The path expressions are [globs](path-expressions.html#globs) and |
| 267 | can match absolute paths or paths relative to the directory of the `OWNERS` |
| 268 | file, but they can only match files in the directory of the `OWNERS` file and |
| 269 | its subdirectories. Multiple path expressions can be specified as a |
| 270 | comma-separated list. |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 271 | |
| 272 | In the example below, Jana Roe, John Doe and the code owners that are inherited |
| 273 | from parent `OWNERS` files are code owners of all files that are contained in |
| 274 | the directory that contains the `OWNERS` file. In addition Richard Roe is a code |
Edwin Kempin | 2b51383 | 2020-12-21 12:33:45 +0100 | [diff] [blame] | 275 | owner of the `docs.config` file in this directory and all `*.md` files in this |
| 276 | directory and the subdirectories. |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 277 | |
| 278 | ``` |
| 279 | [email protected] |
| 280 | [email protected] |
| 281 | per-file docs.config,*[email protected] |
| 282 | ``` |
Edwin Kempin | ed291c9 | 2024-08-19 08:36:03 +0000 | [diff] [blame] | 283 | \ |
Edwin Kempin | 5e18009 | 2022-06-09 13:56:14 +0200 | [diff] [blame] | 284 | **NOTE:** It's important to not include additional spaces in `per-file` lines. |
| 285 | E.g. "per-file docs.config, [email protected]" will make |
| 286 | Richard Roe a code owner of the files "docs.config" and " test.config" (pay |
| 287 | attention to the leading space), but not for the file "test.config". The correct |
| 288 | line to make Richard Roe a code owner of the files "docs.config" and |
| 289 | "test.config" would be "per-file docs.config,[email protected]". |
| 290 | |
Edwin Kempin | 7b8a7c1 | 2020-09-23 15:28:08 +0200 | [diff] [blame] | 291 | ##### <a id="doNotUsePathExpressionsForSubdirectories"> |
Edwin Kempin | f0168ca | 2020-09-17 15:35:40 +0200 | [diff] [blame] | 292 | **NOTE:** It is discouraged to use path expressions that explicitly name |
Edwin Kempin | 2b51383 | 2020-12-21 12:33:45 +0100 | [diff] [blame] | 293 | subdirectories such as `my-subdir/*` as they will break when the subdirectory |
Edwin Kempin | f0168ca | 2020-09-17 15:35:40 +0200 | [diff] [blame] | 294 | gets renamed/moved. Instead prefer to define these code owners in |
| 295 | `my-subdir/OWNERS` so that the code owners for the subdirectory stay intact when |
| 296 | the subdirectory gets renamed/moved. |
| 297 | |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 298 | To grant per-file code ownership to more than one user multiple [user |
| 299 | emails](#userEmails) can be specified as comma-separated list, or an external |
| 300 | `OWNERS` file can be referenced via the [file](#fileKeyword) keyword. |
| 301 | Alternatively the `per-file` line can be repeated multiple times. |
| 302 | |
| 303 | ``` |
| 304 | [email protected] |
| 305 | [email protected] |
| 306 | per-file docs.config,*[email protected],[email protected] |
| 307 | per-file docs.config,*.md=file:/build/OWNERS |
| 308 | ``` |
| 309 | \ |
| 310 | When referencing an external `OWNERS` file via the [file](#fileKeyword) keyword, |
| 311 | only non-restricted [access grants](#accessGrants) are imported. This means |
| 312 | `per-file` rules from the referenced `OWNERS` file are not pulled in and also |
| 313 | any [set noparent](#setNoparent) line in the referenced `OWNERS` file is |
| 314 | ignored, but recursive imports are being resolved. |
| 315 | |
| 316 | Using the [include](#includeKeyword) keyword in combination with a `per-file` |
| 317 | rule is not possible. |
| 318 | |
| 319 | It's also possible to combine [set noparent](#setNoparent) with `per-file` rules |
| 320 | to prevent access by non-per-file owners from the current directory as well as |
| 321 | from parent directories. |
| 322 | |
| 323 | In the example below, Richard Roe is the only code owner of the `docs.config` |
Edwin Kempin | 2b51383 | 2020-12-21 12:33:45 +0100 | [diff] [blame] | 324 | file in this directory and all `*.md` files in this directory and the |
| 325 | subdirectories. All other files in this directory and its subdirectories are |
| 326 | owned by Jana Roe, John Doe and the code owners that are inherited from parent |
| 327 | directories. |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 328 | |
| 329 | ``` |
| 330 | [email protected] |
| 331 | [email protected] |
| 332 | per-file docs.config,*.md=set noparent |
| 333 | per-file docs.config,*[email protected] |
| 334 | ``` |
| 335 | |
Edwin Kempin | 74a4c2f | 2021-05-25 13:12:45 +0200 | [diff] [blame] | 336 | ### <a id="anotations">Annotations |
| 337 | |
Edwin Kempin | 8dae95c | 2022-03-14 15:00:53 +0100 | [diff] [blame] | 338 | Lines that assign code ownership to users ([email lines](#userEmails) and |
| 339 | [per-file lines](#perFile)) can be annotated. Annotations have the format |
| 340 | `#{ANNOTATION_NAME}` and can appear at the end of the line. |
Edwin Kempin | 74a4c2f | 2021-05-25 13:12:45 +0200 | [diff] [blame] | 341 | E.g.: |
| 342 | |
| 343 | ``` |
Edwin Kempin | 9a80096 | 2021-06-11 10:04:53 +0200 | [diff] [blame] | 344 | [email protected] #{LAST_RESORT_SUGGESTION} |
| 345 | per-file docs.config,*[email protected] #{LAST_RESORT_SUGGESTION} |
Edwin Kempin | 74a4c2f | 2021-05-25 13:12:45 +0200 | [diff] [blame] | 346 | ``` |
| 347 | \ |
| 348 | Annotations can be mixed with [comments](#comments) that can appear before and |
| 349 | after annotations, E.g.: |
| 350 | |
| 351 | ``` |
Edwin Kempin | 9a80096 | 2021-06-11 10:04:53 +0200 | [diff] [blame] | 352 | [email protected] # foo bar #{LAST_RESORT_SUGGESTION} baz |
Edwin Kempin | 74a4c2f | 2021-05-25 13:12:45 +0200 | [diff] [blame] | 353 | ``` |
| 354 | \ |
| 355 | The following annotations are supported: |
| 356 | |
Edwin Kempin | 9a80096 | 2021-06-11 10:04:53 +0200 | [diff] [blame] | 357 | #### <a id="lastResortSuggestion"> |
| 358 | * `LAST_RESORT_SUGGESTION`: |
Edwin Kempin | 74a4c2f | 2021-05-25 13:12:45 +0200 | [diff] [blame] | 359 | Code owners with this annotation are omitted when [suggesting code |
Edwin Kempin | 66ee575 | 2021-06-09 13:35:57 +0200 | [diff] [blame] | 360 | owners](rest-api.html#list-code-owners-for-path-in-change), except if dropping |
Edwin Kempin | 3acf4bd | 2021-07-26 11:29:48 +0200 | [diff] [blame] | 361 | these code owners would make the suggestion result empty or if these code |
| 362 | owners are already reviewers of the change. If code ownership is assigned to |
| 363 | the same code owner through multiple relevant access grants in the same code |
| 364 | owner config file or in other relevant code owner config files the code owner |
| 365 | gets omitted from the suggestion if it has the `LAST_RESORT_SUGGESTION` set on |
| 366 | any of the access grants. |
Edwin Kempin | 74a4c2f | 2021-05-25 13:12:45 +0200 | [diff] [blame] | 367 | |
| 368 | Unknown annotations are silently ignored. |
| 369 | |
Edwin Kempin | 8dae95c | 2022-03-14 15:00:53 +0100 | [diff] [blame] | 370 | **NOTE:** If a line that assigns code ownership to multiple users has an |
| 371 | annotation, this annotation applies to all these users. E.g. if an annotation is |
| 372 | set for the all users wildcard (aka `*`) it applies to all users. |
| 373 | |
Edwin Kempin | 62dfffa | 2023-01-13 09:17:35 +0100 | [diff] [blame] | 374 | **NOTE:** Only [email lines](#userEmails) and [per-file lines](#perFile) that |
| 375 | assign code ownership directly to users support annotations, for other lines |
| 376 | (e.g. [file lines](#fileKeyword), [include lines](#includeKeyword) and |
| 377 | [per-file lines](#perFile) that reference other `OWNERS` files via the |
| 378 | [file](#fileKeyword) keyword) annotations are interpreted as |
| 379 | [comments](#comments) and are silently ignored. |
Edwin Kempin | 74a4c2f | 2021-05-25 13:12:45 +0200 | [diff] [blame] | 380 | |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 381 | ### <a id="comments">Comments |
| 382 | |
| 383 | The '#' character indicates the beginning of a comment. Arbitrary text may be |
| 384 | added in comments. |
| 385 | |
Edwin Kempin | 3114804 | 2021-06-21 09:43:13 +0200 | [diff] [blame] | 386 | Comments can appear at the end of any line or consume the whole line (a line |
| 387 | starting with '#', `# <comment-test`). |
Edwin Kempin | c2fc7bf | 2020-09-16 08:15:50 +0200 | [diff] [blame] | 388 | |
| 389 | Comments are not interpreted by the `code-owners` plugin and are intended for |
| 390 | human readers of the `OWNERS` files. However some projects/teams may have own |
| 391 | tooling that uses comments to store additional information in `OWNERS` files. |
| 392 | |
Edwin Kempin | 9d486ed | 2020-09-15 15:05:23 +0200 | [diff] [blame] | 393 | --- |
| 394 | |
| 395 | Back to [@PLUGIN@ documentation index](index.html) |
| 396 | |
| 397 | Part of [Gerrit Code Review](../../../Documentation/index.html) |