Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Exist Checker fails on valid relative paths checked in all directories by CODEOWNERS #68

Open
akien-mga opened this issue Feb 16, 2021 · 3 comments · May be fixed by #69
Open

File Exist Checker fails on valid relative paths checked in all directories by CODEOWNERS #68

akien-mga opened this issue Feb 16, 2021 · 3 comments · May be fixed by #69
Assignees
Labels
bug Something isn't working
Milestone

Comments

@akien-mga
Copy link

First of all thank you for this tool, it helped me fixed CODEOWNERS for https://github.com/godotengine/godot
Turns out that review-requests don't work for teams without Write permission for some reason (as if a review from someone not able to press "Merge" is not valid), but your tool caught it + more issues :)

Version
0.6.0, installed in ./bin with curl instructions.

Description

There seems to be a false positive report from the File Exist Checker when using relative paths which are then checked in all directories by CODEOWNERS.
What I mean is what is described here: https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax

# In this example, @octocat owns any file in an apps directory
# anywhere in your repository.
apps/ @octocat

This will successfully match apps/ directories in any directory of the repository, even if there's no apps/ directory in the root.
But codeowners-validator issues a warning about this case.

Expected result
No warning if any nested directory matches the pattern.

Actual result

==> Executing File Exist Checker (45.227677ms)
    [err] line 11: "SCsub" does not match any files in repository
    [err] line 23: "doc_classes/*" does not match any files in repository

Yet:

$ find -type f -name SCsub | wc -l
124
$ find -type d -name doc_classes | wc -l
19

(This is on https://github.com/godotengine/godot/)

Steps to reproduce

Troubleshooting
n/a

@akien-mga akien-mga added the bug Something isn't working label Feb 16, 2021
@mszostok
Copy link
Owner

mszostok commented Feb 18, 2021

Hi @akien-mga

Thank you for getting in touch!

First what you can do is to disable the file checker. As a result, you can benefit from other checks.

env REPOSITORY_PATH="." \
    CHECKS="owners,syntax,duppatterns" \
    OWNER_CHECKER_REPOSITORY="godotengine/godot" \
  ./bin/codeowners-validator

or with GitHub Action:

name: codeowners-validator

on:
  schedule:
    # Runs at 08:00 UTC every day
    - cron:  '0 8 * * *'
  workflow_dispatch:

jobs:
  sanity:
    runs-on: ubuntu-latest
    steps:
      # Checks-out your repository, which is validated in the next step
      - uses: actions/checkout@v2
      - name: GitHub CODEOWNERS Validator
        uses: mszostok/[email protected]
        with:
          checks: "owners,duppatterns,syntax" # `files` check not specified 
          experimental_checks: "notowned"
          # GitHub access token is required only if the `owners` check is enabled
          github_access_token: "${{ secrets.OWNERS_VALIDATOR_GITHUB_SECRET }}"

In the meantime I will check implementation and I will ping you when new version with fix will be available :)

@mszostok mszostok added this to the v0.7.0 milestone Feb 18, 2021
@akien-mga
Copy link
Author

Thanks :) I did use the other checks successfully, so I'm just reporting this as a false positive but it's in no way blocking.

@mszostok mszostok modified the milestones: v1.0.0, Next Aug 5, 2022
@mszostok mszostok modified the milestones: Next, v0.8.0 Aug 17, 2022
@danxmoran
Copy link

@mszostok this same issue affects files as well as directories, if that affects the implementation of the fix. For example if I have:

conftest.py  @octocat

GitHub will match the pattern against any conftest.py in the repo, but the file checker will only pass if I have a conftest.py in my repo root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants