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

impossible to define exclude and include properties at the pyproject level #281

Open
jeremycohensolal opened this issue Jul 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jeremycohensolal
Copy link

Description

If you want to use include or exclude filter defined in your pyproject... it won't be applied

Steps to reproduce

Add this section in your pyproject.toml

[tool.yamlfix]
# https://lyz-code.github.io/yamlfix
allow_duplicate_keys = true
line_length = 120
none_representation = "null"
explicit_start = false
sequence_style = "block_style"
section_whitelines = 1
exclude=["dbt_packages/**/*"]

Current behavior

Exclude is not applied to file selection.

Desired behavior

Excluded globs should be used the same way than with --exclude cli argument

Environment

Tested on 1.16.9

Tech deep dive

It seems that the issue is located in your "endpoints/cli.py"

Here you collect elligible files specifying exclude/include from cli arguments

real_files.extend(_find_all_yaml_files(provided_file, include, exclude))

but the loading of the pyproject.toml config (with maison) is made later in the file... so the file collect has already been made, and it's too late to filter it again...

@jeremycohensolal jeremycohensolal added the bug Something isn't working label Jul 11, 2024
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

No branches or pull requests

1 participant