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
Create template_instead_of_copy.py #2346
Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, thanks for contributing this new rule. Here are few things missing:
- no tests included
- no markdown documentation included, create a template-instead-of-copy.md file in the same directory as the rule and try to match the same format used from the other rules, with before/after examples.
- rules should trigger only if user tries to use jinja inside content, not on just the presence of content key.
Will check.
Will check.
IMHO, this is only part of the solution. Thinking about the comment and the linked threads, I probably want to trigger if at least one of the following is true:
What do you think? |
Please add tests. That will make your target use cases easier to understand. Please make sure you have a test that shows |
8267498
to
b7739da
Compare
I'm kind of confused about this comment. What could be "incorrect" from using copy[content] instead of template? EDIT: Nvm, I missed the rewrite because it hasn't been released yet. |
@bendem Ping me back if the current version is still unclear, I can ask someone else to produce even more detailed examples and/or explanation. From what I understood, the difference is subtle, but it is. That rule is not about "style" preference, is about the risk of getting an unexpected outcome. |
I'm sending a PR in response to a request to upstream a rule that complains about templating inside of
ansible.builtin.copy
. I'm sorry, I did not know how to decide on severity nor did I know how to find out in which version of Ansible that warning was added to the documentation.