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

Avoid looking for config file outside current git repo #1436

Merged
merged 1 commit into from
Mar 6, 2021
Merged

Conversation

ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented Mar 6, 2021

This fixes a bug where running the linter inside a project that did
not had a config file could endup picking a config file from another
project (was happening only when projects were nested).

From now on, we stop looking at parent directories when we encounter
the .git folder, which can be seen as project boundary.

@ssbarnea ssbarnea added the bug label Mar 6, 2021
This fixes a bug where running the linter inside a project that did
not had a config file could end-up picking a config file from another
project (was happening only when projects were nested).

From now on, we stop looking at parent directories when we encounter
the .git folder, which can be seen as project boundary.
@aminvakil
Copy link
Contributor

This is definitely an improvement, but isn't there a better way than looking for .git folder in order to be sure ansible-lint should not search in parent directory anymore?

@ssbarnea
Copy link
Member Author

ssbarnea commented Mar 6, 2021

This is definitely an improvement, but isn't there a better way than looking for .git folder in order to be sure ansible-lint should not search in parent directory anymore?

There is but I did not bother using the external command for this particular case because the other approach would have
ended up bigger, and likely a little bit slower.

I do not expect this to be perfect but considering that discovery of config file was not even documented I doubt it will create any regressions. In fact I needed this change do the #1434 which uncovered this bug: mainly I am cloning some repos inside .cache and try to lint them. One of them does not have a linter config and it fails to run because without this change the linter loads the config from the upper level, which is not desired. I doubt anyone was so crazy to nest repos

@ssbarnea ssbarnea merged commit 64d29ab into master Mar 6, 2021
@ssbarnea ssbarnea deleted the 0/labels branch March 6, 2021 10:15
This was referenced Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants