Skip to content

Commit fd89ca2

Browse files
authored
fix: update documentation to clarify requirement to run from project … (#4885)
1 parent 62dda96 commit fd89ca2

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

docs/configuring.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ Customize how Ansible-lint runs against automation content to suit your needs.
44
You can ignore certain rules, enable `opt-in` rules, and control various other
55
settings.
66

7-
Ansible-lint loads configuration from a file in the current working directory or
8-
from a file that you specify in the command line.
7+
Ansible-lint loads configuration from a file in the project root directory (current
8+
working directory) or from a file that you specify in the command line. Executing the
9+
linter from the project root is required for correct file discovery and dependency resolution.
910

1011
Any configuration option that is passed from the command line will override
1112
the one specified inside the configuration file.
@@ -19,8 +20,11 @@ in your current working directory.
1920

2021
!!! note
2122

22-
If Ansible-lint cannot find a configuration file in the current directory it attempts to locate it in a parent directory.
23-
However Ansible-lint does not try to load configuration that is outside the git repository.
23+
If Ansible-lint cannot find a configuration file in the current directory it
24+
attempts to locate it in a parent directory. However, Ansible-lint does not
25+
try to load configuration that is outside the git repository. **Note that
26+
while the config may be found in a parent directory, the linter still
27+
expects to be executed from the root of the project being linted.**
2428

2529
## Specifying configuration files
2630

docs/usage.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ where it failed to work as expected and caused false negatives.
5555

5656
## Linting playbooks and roles
5757

58+
!!! warning "Execution Directory"
59+
60+
**Always run `ansible-lint` from the root of your project or collection.**
61+
As of version 25.7.0, running the linter from within a subdirectory
62+
(such as inside a `roles/` or `tasks/` folder) is not supported and
63+
may result in zero errors being reported even if violations exist.
64+
5865
Ansible-lint recommends following the [collection structure layout] whether you
5966
plan to build a collection or not.
6067

src/ansiblelint/schemas/__store__.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"ansible-lint-config": {
3-
"etag": "d08ce380364a2935299f89bf453787601d44a1bc6b70a38afaec4a8b0b80d104",
3+
"etag": "1fe2e8bc4dd6a77c4055bf063a0983725fde4133c981335413d6503fe2e543ed",
44
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible-lint-config.json"
55
},
66
"ansible-navigator-config": {
@@ -24,7 +24,7 @@
2424
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json"
2525
},
2626
"meta": {
27-
"etag": "d63b91b4cb6a73cde4d9d98b7b5d9bbaf8ed568173e90682afb5b11cd6ba55b3",
27+
"etag": "d2f353a0077365ff075b14876b619ef65e7268129fd12b4f1b571549f2f39f14",
2828
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta.json"
2929
},
3030
"meta-runtime": {

0 commit comments

Comments
 (0)