Ensure CODEOWNERS defined in projects
  • Updated on 22 Apr 2019
  • 1 minute to read
  • Contributors
  • Share
  • Dark
    Light

Ensure CODEOWNERS defined in projects

  • Share
  • Dark
    Light

This rule makes sure CODEOWNERS file is located inside the repository.

The CODEOWNERS file can define and assign different pull request approvals for different parts of code.

# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in the repo.
*       @defunkt

# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners
# will be requested to review.
*.js    @octocat @github/js

# You can also use email addresses if you prefer.
docs/*  docs@example.com

Use case(s)

  • Define people or teams responsible for a project or files inside the project
  • Automatically requests reviews from the pre-defined code owners

When does this rule fail?

When there is no CODEOWNERS file inside the repository (in the correct file path location).

CODEOWNERS file should be located inside one following path:
➡️ root-dir/
➡️ root-dir/docs/
➡️ root-dir/.github/

3x-0d41c93-Screen_Shot_2019-01-17_at_11.42.12.png

How to fix?

  1. Create a meaningful CODEOWNERS file according to your project requirements
  2. Commit and push the new CODEOWNERS file to the branch
  3. Datree's automatic policy check makes sure a CODEOWNERS file is included in the pull request


What's Next

Activate a policy
Was this article helpful?