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, not strings #4210

Draft
wants to merge 11 commits 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.

Copy link

github-actions bot commented Jun 5, 2024

Label error. Requires exactly 1 of: bug, enhancement, major, minor, patch, skip-changelog. Found:

@janmondry
Copy link
Author

pre-commit.ci autofix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

1 participant