Support fallback code owner for paths that have no code owners defined

It's now possible to configure a policy for fallback code owners that
applies for paths for which no code owners have been defined.

The supported options are NONE (no fallback code owners, current
behaviour) and ALL_USERS (files with no defined code owners are owned by
all users). It's possible that we will add support for further options,
e.g. PROJECT_OWNERS (files with no defined code owners are owned by the
project owners), in future.

If ALL_USERS is configured we have the following behaviour:

1. if for a path no code owners are defined, the path is owned by all
   users
2. if for a path code owners are defined, only these users own the path
3. if for a path code owners are defined, but none of them is resolvable
   the path is owned by no one and changes require an override for
   submission

The ALL_USERS option should only be used with care as it means that any
path that is not covered by the code owner config files is automatically
opened up to everyone and mistakes with configuring code owners can
easily happen. This is why this option is intended to be only used if
requiring code owner approvals should not be enforced.

The CodeOwnerApprovalCheck tests for fallback code owners are in a
separate test class
(CodeOwnerApprovalCheckWithAllUsersAsFallbackCodeOwnersTest) since the
CodeOwnerApprovalCheckTest test class is already way too large.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I42774589cfd1898780379b76cdd6daf1bcb7ff4a
12 files changed
tree: 15fc261d67ca9aad1740aa6c816bb39f921026fc
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. test/
  6. ui/
  7. .eslintrc.json
  8. .gitignore
  9. .gitreview
  10. bower.json
  11. BUILD
  12. LICENSE
  13. package-lock.json
  14. package.json
  15. README.md
README.md

Gerrit Code Review code-owners plugin

This plugin provides support for defining code owners for files in a repository.

If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.

Also see resources/Documentation/about.md

IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md