最新¶
latest
规则检查模块参数(例如用于源代码控制签出的参数)是否包含可能根据上下文生成不同结果的参数。
此更通用的规则替换了两个名为git-latest
和hg-latest
的旧规则。
我们知道,在某些情况下,获取主分支的最新提交并非偶然。对于这些情况,只需在同一行添加注释,例如# noqa: latest
,即可防止其触发。
可能的错误消息:¶
latest[git]
latest[hg]
问题代码¶
---
- name: Example for `latest` rule
hosts: localhost
tasks:
- name: Risky use of git module
ansible.builtin.git:
repo: "https://github.com/ansible/ansible-lint"
version: HEAD # <-- HEAD value is triggering the rule