Add `MALFORMED_ENTRY_OWNER` error for CODEOWNERS

What does this MR do and why?

Problem

We currently use Entries with spaces for some errors that are actually Malformed owners. We need to change this so we convey a clear message of what's actually happening in the error.

Solution

We should add a new error type MALFORMED_ENTRY_OWNER: Malformed Owners to be more specific about the error we are returning

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2025-02-11_at_12.08.07 Screenshot_2025-02-11_at_12.09.17

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Navigate to existing or create new CODEOWNERS file
  2. Add your CODEOWNERS entries or use this
# Regular owner
*.rb @valid-user

# Just invalid owners
*.js not_a_user_not_an_email

# mixed of valid and invalid
*.js malformed @valid-user @valid-group another_malformed
  1. Go to ee/lib/gitlab/code_owners/file.rb and change add_error(Error::INVALID_ENTRY_OWNER_FORMAT, line_number) to add_error(Error::MALFORMED_ENTRY_OWNER, line_number)
  2. Refresh CODEOWNERS in gdk
  3. You should see the error for line 5.

Related to #517961 (closed)

Edited by Olaoluwa Oluro

Merge request reports

Loading