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

feat: add file-or-directory-existence rule #291

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Brend-Smits
Copy link
Collaborator

Motivation

Sometimes we might need to check whether a repository contains at least one directory or file whose name matches a certain regular expression. Although file-existence and directory-existence rules exist, these two can not be combined within one single rule.

Proposed Changes

This PR implements a file-or-directory-existence rule which aims at checking whether there is at least one file or directory specified in globsAny whose name matches a regular expression.

Test Plan

  • it returns a passed result if both files and directories exist matching the given pattern
  • it returns a passed result if only files exist matching the given pattern
  • it returns a passed result if only directories exist matching the given pattern
  • it returns a failed result if neither files or directories exist matching the given pattern

Original Pull Request: philips-forks#19

Co-authored-by: Dragos Serban <[email protected]>
Signed-off-by: Brend Smits <[email protected]>
@zhaoyuheng200
Copy link
Member

I think the file-existence rule with options dirs:true cover this scenario.
directory-existence is file-existence with dirs:true and it works the for both file and dirs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants