-
Notifications
You must be signed in to change notification settings - Fork 705
Open
Description
ansible-lint
documentation recommends to install custom rules as packages.
However, several online tutorials suggest to use the -r
CLI flag to specify a directory for ansible-lint
to pick up user-defined custom rules.
First (suggestion), when using -r ./custom-rules/
, I think it would be very handy to have a warning produced informing the user that embedded rules are disabled.
Second (actual bug), there is also a -R
flag, documented like this in 25.8.2
in the --help
output:
-r RULESDIR, --rules-dir RULESDIR
Specify custom rule directories. Add -R to keep using embedded rules from /home/lucas_cimon/.local/share/virtualenvs/chezsoi/lib/python3.10/site-packages/ansiblelint/rules
-R Keep default rules when using -r
However, based on some basic test with the embedded risky-file-permissions
rule, even when using -R
the embedded rules are disabled.
Issue Type
- Bug Report
OS / ENVIRONMENT
Ubuntu 22.04
ansible-lint --version
ansible-lint 25.8.2 using ansible-core:2.17.13 ansible-compat:25.8.1 ruamel-yaml:0.18.14 ruamel-yaml-clib:0.2.12
- ansible installation method:
pip
- ansible-lint installation method:
pip
STEPS TO REPRODUCE
mkdir /tmp/bugrepro
cd /tmp/bugrepro
mkdir -p roles/bugrepro/tasks
cat <<EOF >roles/bugrepro/tasks/main.yaml
- name: Create /tmp/dummy
ansible.builtin.file:
path: /tmp/dummy
state: directory
> EOF
ansible-lint # correctly reports an issue with the risky-file-permissions rule
mkdir custom-rules
ansible-lint -R custom-rules # does not report any issue
Desired Behavior
- when using
-R
, embedded rules should not be disabled (actual bug) - when using
-r
, a warning should be produced to recommend to switch to-R
(suggestion)
Actual Behavior
When using -R
, embedded rules are disabled.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status