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

Edit path_inject() to compare Paths instead of strings #4210

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

Conversation

janmondry
Copy link

There's an issue causing unnecessary warning:
https://github.com/ansible/ansible-lint/blob/main/src/ansiblelint/__main__.py#L464
if (parent / "ansible").exists() and str(parent) not in paths

Personally I encountered a case when:

  • a path in PATH ends with a trailing slash (which is correct) (eg. /app/bin/)
  • str(parent) returned almost exactly the same path, but without the trailing slash, (eg. /app/bin)

which resulted in failing the string comparison (eg. '/app/bin/' not in ['/app/bin']).

Comparing Path objects solves the problem.

@janmondry

This comment was marked as outdated.

@ssbarnea ssbarnea changed the title Edit path_inject() to compare Paths, not strings Edit path_inject() to compare Paths instead of strings Sep 19, 2024
@ssbarnea ssbarnea added the incomplete Additional work or information is required label Sep 19, 2024
@ssbarnea
Copy link
Member

@janmondry Can you please check this as the use of site seems to be causing some very weird test failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug incomplete Additional work or information is required
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants