codeowners-validator icon indicating copy to clipboard operation
codeowners-validator copied to clipboard

Feature request: fail for deleted files that are explicitly owned in CODEOWNERS

Open devth opened this issue 1 year ago • 4 comments

Description

If I have a file foo/bar.go explicitly covered by CODEOWNERS, e.g.

foo/bar.go @org/team

and I open a PR which deletes foo/bar.go, I'd like codeowners-validator to fail with a message saying something like:

File foo/bar.go does not exist, yet is covered in CODEOWENERS line 1 by the rule foo/bar.go @org/team

Reasons

You could argue that a CODEOWNERS file that contains rules for non-existent files is invalid. An error like above (maybe it's configurable) would prevent CODEOWNERS files from getting stale.

devth avatar Apr 19 '23 23:04 devth

👋🏻 Would you be open to a PR for this?

devth avatar Apr 20 '23 14:04 devth

Hi @devth

I like the idea that you posted, and PR is always welcome 👍 I will do my best to do the review ASAP 👍

mszostok avatar Apr 20 '23 18:04 mszostok

Thanks! I'll see when I get to it.

Do you think this behavior should be configurable, or always on?

devth avatar Apr 21 '23 00:04 devth

I try to maintain a behavior where all checks are optional, so each one can always enable what they really need to 👍

mszostok avatar Apr 21 '23 09:04 mszostok