summaryrefslogtreecommitdiffstats
path: root/src/ansiblelint/rules/only_builtins.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/ansiblelint/rules/only_builtins.py')
-rw-r--r--src/ansiblelint/rules/only_builtins.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ansiblelint/rules/only_builtins.py b/src/ansiblelint/rules/only_builtins.py
index 78ad93a..3757af8 100644
--- a/src/ansiblelint/rules/only_builtins.py
+++ b/src/ansiblelint/rules/only_builtins.py
@@ -1,11 +1,11 @@
"""Rule definition for usage of builtin actions only."""
+
from __future__ import annotations
import os
import sys
from typing import TYPE_CHECKING
-from ansiblelint.config import options
from ansiblelint.rules import AnsibleLintRule
from ansiblelint.rules.fqcn import builtins
from ansiblelint.skip_utils import is_nested_task
@@ -33,9 +33,11 @@ class OnlyBuiltinsRule(AnsibleLintRule):
allowed_collections = [
"ansible.builtin",
"ansible.legacy",
- *options.only_builtins_allow_collections,
]
- allowed_modules = builtins + options.only_builtins_allow_modules
+ allowed_modules = builtins
+ if self.options:
+ allowed_collections += self.options.only_builtins_allow_collections
+ allowed_modules += self.options.only_builtins_allow_modules
is_allowed = (
any(module.startswith(f"{prefix}.") for prefix in allowed_collections)