This commit is contained in:
mrT23
2023-11-23 09:16:50 +02:00
parent d6d362b51e
commit e80a0ed9c8
3 changed files with 14 additions and 4 deletions

View File

@ -37,9 +37,14 @@ To ignore files or directories, edit the **[ignore.toml](/pr_agent/settings/igno
- `IGNORE.GLOB`
- `IGNORE.REGEX`
For example, to ignore python files in a PR, set:
For example, to ignore python files in a PR with online usage, comment on a PR:
`/review --ignore.glob=['*.py']`
`ignore.glob = ['*.py']`
To ignore python files in all PRs, set in a configuration file:
```
[ignore]
glob = ['*.py']
```
#### git provider
The [git_provider](pr_agent/settings/configuration.toml#L4) field in the configuration file determines the GIT provider that will be used by PR-Agent. Currently, the following providers are supported:

View File

@ -11,7 +11,12 @@ def filter_ignored(files):
try:
# load regex patterns, and translate glob patterns to regex
patterns = get_settings().ignore.regex
patterns += [fnmatch.translate(glob) for glob in get_settings().ignore.glob]
if isinstance(patterns, str):
patterns = [patterns]
glob_setting = get_settings().ignore.glob
if isinstance(glob_setting, str): # --ignore.glob=[.*utils.py], --ignore.glob=.*utils.py
glob_setting = glob_setting.strip('[]').split(",")
patterns += [fnmatch.translate(glob) for glob in glob_setting]
# compile all valid patterns
compiled_patterns = []

View File

@ -282,7 +282,7 @@ def _fix_key_value(key: str, value: str):
try:
value = yaml.safe_load(value)
except Exception as e:
get_logger().error(f"Failed to parse YAML for config override {key}={value}", exc_info=e)
get_logger().debug(f"Failed to parse YAML for config override {key}={value}", exc_info=e)
return key, value