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

Look for per-project configuration file in parent directories #572

Merged
merged 1 commit into from
May 22, 2023
Merged

Look for per-project configuration file in parent directories #572

merged 1 commit into from
May 22, 2023

Conversation

chutzimir
Copy link
Contributor

Inspired be ESLint's search, it looks for configuration files in all parent directories up until it reaches the user's home or root.

closes #571

Copy link
Owner

@adrienverge adrienverge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, thanks for this idea and implementation!

Although I'm favorable to the idea, this is a breaking change (behavior would start changing if top-level .yamllint files would be taken into account). Is anyone following this repo opposed to this?

Can you also add a test_multiple_parent_config_file() that checks that if multiple config files have conflicting rules options, the closest one takes precedence?

docs/configuration.rst Outdated Show resolved Hide resolved
tests/test_cli.py Show resolved Hide resolved
yamllint/cli.py Outdated Show resolved Hide resolved
yamllint/cli.py Outdated Show resolved Hide resolved
yamllint/cli.py Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented May 11, 2023

Coverage Status

Coverage: 99.392% (+0.006%) from 99.386% when pulling 80c1daa on chutzimir:parent-dir-config into 019c87d on adrienverge:master.

@coveralls
Copy link

Coverage Status

Coverage: 99.31% (-0.08%) from 99.386% when pulling 584ae2c on chutzimir:parent-dir-config into 019c87d on adrienverge:master.

@chutzimir
Copy link
Contributor Author

chutzimir commented May 11, 2023

I addressed all of the above comments, so let me mark them as resolved. I just now noticed the CONTRIBUTING.md file, so I also fixed the linting problems per flake8 advice. I squashed the commits too, to keep the git history clean.

As to whether this is a breaking change or not... I understand your sentiment. I just want to note that I found it very counterintuitive to get different behavior when I edit a file depending on which directory I start from.

Copy link
Owner

@adrienverge adrienverge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updated version @chutzimir, it looks good. Please see my 2 comments.

Since no one seems to be opposed to this feature (which is a breaking change), I'm +1 to merge it.

yamllint/cli.py Outdated Show resolved Hide resolved
yamllint/cli.py Outdated Show resolved Hide resolved
Inspired be ESLint's search, it looks for configuration files in all
parent directories up until it reaches the user's home or root.

closes #571
Copy link
Owner

@adrienverge adrienverge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks for contributing to yamllint Georgi 👍

@adrienverge adrienverge merged commit e636848 into adrienverge:master May 22, 2023
6 checks passed
@chutzimir chutzimir deleted the parent-dir-config branch May 23, 2023 10:12
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.

Look for per-project configuration file in parent directories
3 participants