vscode-ansible
vscode-ansible copied to clipboard
Tags in .ansible-lint warn_list showing as errors instead of warnings
Summary
Tags that are set in .ansible-lint under warn_list are showing as errors instead of warnings.
Other configuration settings such as exclude_paths and skip_list work correctly.
Environment
Project tree
.
├── .ansible-lint
├── [...]
├── mailserver.yml
└── [...]
.ansible-lint file contents
---
#.ansible-lint
exclude_paths:
- roles/
skip_list:
- yaml[line-length]
warn_list:
- name[casing]
- jinja[spacing]
mailserver.yml file contents
---
- name: Setup Mail Server Database
hosts: mailserver_database
become: true
roles:
- role: bcook254.postgresql
- name: Setup Mail Server
hosts: mailserver
become: true
pre_tasks:
- name: Set repo if Alpine
ansible.builtin.set_fact:
version: "={{ nginx_alpine_version }}"
when: ansible_facts['os_family'] == "Alpine"
- name: Set repo if Debian
ansible.builtin.set_fact:
version: "={{ nginx_debian_version }}~{{ ansible_facts['distribution_release'] }}"
when: ansible_facts['os_family'] == "Debian"
- name: Set repo if Red Hat
ansible.builtin.set_fact:
version: "-{{ nginx_redhat_version }}.{{ (ansible_facts['distribution']=='Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx"
when: ansible_facts['os_family'] == "RedHat"
- name: Enable NGINX @CentOS-AppStream dnf modules
ansible.builtin.shell:
args:
cmd: dnf module info nginx | grep -q 'Stream.*\[e\]' && echo -n ENABLED || dnf module enable -y nginx
register: dnf_module_enable
changed_when: dnf_module_enable.stdout != 'ENABLED'
when: ansible_facts['os_family'] == "RedHat" and ansible_facts['distribution_major_version'] is version('8', '==')
roles:
- role: geerlingguy.php-versions
- role: geerlingguy.php
- role: geerlingguy.redis
- role: nginxinc.nginx
vars:
nginx_version: "{{ version }}"
- role: nginxinc.nginx_config
Resulting errors in VSCode

Expected results
The jinja[spacing] error should be a warning instead of an error
Output from ansible-lint mailserver.yml command

Other steps taken
- Adding
-c [...]\infra\.ansible-lintto lint arguments did not change the output. - Review of #667 says it should be working now but changing to v1.1 did not change the output.
Extension version
1.2.44
VS Code version
1.77.1
Ansible Version
ansible [core 2.14.4]
config file = None
configured module search path = ['/home/bcook254/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/bcook254/.local/lib/python3.11/site-packages/ansible
ansible collection location = /home/bcook254/.ansible/collections:/usr/share/ansible/collections
executable location = /home/bcook254/.local/bin/ansible
python version = 3.11.2 (main, Feb 8 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] (/usr/bin/python)
jinja version = 3.1.2
libyaml = True
OS / Environment
Fedora 36, ansible-lint 6.14.4
Relevant log output
[Trace - 4:45:50 PM] Sending request 'initialize - (0)'.
Params: {
"processId": 22874,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.77.1"
},
"locale": "en-us",
"rootPath": "/home/bcook254/Projects/infra",
"rootUri": "file:///home/bcook254/Projects/infra",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": true
}
},
"configuration": true,
"didChangeWatchedFiles": {
"dynamicRegistration": true,
"relativePatternSupport": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
},
"resolveSupport": {
"properties": [
"location.range"
]
}
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"workspaceFolders": true,
"semanticTokens": {
"refreshSupport": true
},
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
},
"inlineValue": {
"refreshSupport": true
},
"inlayHint": {
"refreshSupport": true
},
"diagnostics": {
"refreshSupport": true
}
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"insertReplaceSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"insertTextModeSupport": {
"valueSet": [
1,
2
]
},
"labelDetailsSupport": true
},
"insertTextMode": 2,
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
},
"completionList": {
"itemDefaults": [
"commitCharacters",
"editRange",
"insertTextFormat",
"insertTextMode"
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
},
"activeParameterSupport": true
},
"contextSupport": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"honorsChangeAnnotations": false
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true,
"prepareSupportDefaultBehavior": 1,
"honorsChangeAnnotations": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true,
"foldingRangeKind": {
"valueSet": [
"comment",
"imports",
"region"
]
},
"foldingRange": {
"collapsedText": false
}
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"operator",
"decorator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false,
"serverCancelSupport": true,
"augmentsSyntaxTokens": true
},
"linkedEditingRange": {
"dynamicRegistration": true
},
"typeHierarchy": {
"dynamicRegistration": true
},
"inlineValue": {
"dynamicRegistration": true
},
"inlayHint": {
"dynamicRegistration": true,
"resolveSupport": {
"properties": [
"tooltip",
"textEdits",
"label.tooltip",
"label.location",
"label.command"
]
}
},
"diagnostic": {
"dynamicRegistration": true,
"relatedDocumentSupport": false
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"staleRequestSupport": {
"cancel": true,
"retryOnContentModified": [
"textDocument/semanticTokens/full",
"textDocument/semanticTokens/range",
"textDocument/semanticTokens/full/delta"
]
},
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "1.1.0"
},
"positionEncodings": [
"utf-16"
]
},
"notebookDocument": {
"synchronization": {
"dynamicRegistration": true,
"executionSummarySupport": true
}
}
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/bcook254/Projects/infra",
"name": "infra"
}
]
}
[Trace - 4:45:50 PM] Received response 'initialize - (0)' in 196ms.
Result: {
"capabilities": {
"textDocumentSync": 2,
"semanticTokensProvider": {
"documentSelector": [
{
"language": "ansible"
}
],
"full": true,
"legend": {
"tokenTypes": [
"method",
"class",
"keyword",
"property"
],
"tokenModifiers": [
"definition"
]
}
},
"hoverProvider": true,
"completionProvider": {
"resolveProvider": true
},
"definitionProvider": true,
"workspace": {
"workspaceFolders": {
"supported": true,
"changeNotifications": true
}
}
}
}
[Trace - 4:45:50 PM] Sending notification 'initialized'.
Params: {}
[Trace - 4:45:50 PM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/bcook254/Projects/infra/mailserver.yml",
"languageId": "ansible",
"version": 1,
"text": "---\n- name: Setup Mail Server Database\n hosts: mailserver_database\n become: true\n\n roles:\n - role: bcook254.postgresql\n\n- name: Setup Mail Server\n hosts: mailserver\n become: true\n\n pre_tasks:\n - name: Set repo if Alpine\n ansible.builtin.set_fact:\n version: \"={{ nginx_alpine_version }}\"\n when: ansible_facts['os_family'] == \"Alpine\"\n - name: Set repo if Debian\n ansible.builtin.set_fact:\n version: \"={{ nginx_debian_version }}~{{ ansible_facts['distribution_release'] }}\"\n when: ansible_facts['os_family'] == \"Debian\"\n - name: Set repo if Red Hat\n ansible.builtin.set_fact:\n version: \"-{{ nginx_redhat_version }}.{{ (ansible_facts['distribution']=='Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx\"\n when: ansible_facts['os_family'] == \"RedHat\"\n - name: Enable NGINX @CentOS-AppStream dnf modules\n ansible.builtin.shell:\n args:\n cmd: dnf module info nginx | grep -q 'Stream.*\\[e\\]' && echo -n ENABLED || dnf module enable -y nginx\n register: dnf_module_enable\n changed_when: dnf_module_enable.stdout != 'ENABLED'\n when: ansible_facts['os_family'] == \"RedHat\" and ansible_facts['distribution_major_version'] is version('8', '==')\n\n roles:\n - role: geerlingguy.php-versions\n - role: geerlingguy.php\n - role: geerlingguy.redis\n - role: nginxinc.nginx\n vars:\n nginx_version: \"{{ version }}\"\n - role: nginxinc.nginx_config\n"
}
}
[Trace - 4:45:50 PM] Sending notification 'update/ansible-metadata'.
Params: [
[
"file:///home/bcook254/Projects/infra/mailserver.yml"
]
]
[Trace - 4:45:50 PM] Received request 'client/registerCapability - (0)'.
Params: {
"registrations": [
{
"id": "c8ecb369-8d88-406e-ab55-86c4d13abffc",
"method": "workspace/didChangeConfiguration",
"registerOptions": {
"section": "ansible"
}
}
]
}
[Trace - 4:45:50 PM] Sending response 'client/registerCapability - (0)'. Processing request took 1ms
No result returned.
[Trace - 4:45:50 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
"settings": {
"ansible": {
"ansible": {
"path": "ansible",
"useFullyQualifiedCollectionNames": true,
"reuseTerminal": false
},
"python": {
"interpreterPath": "python3",
"activationScript": ""
},
"ansibleNavigator": {
"path": "ansible-navigator"
},
"completion": {
"provideRedirectModules": true,
"provideModuleOptionAliases": true
},
"validation": {
"enabled": true,
"lint": {
"enabled": true,
"path": "ansible-lint",
"arguments": ""
}
},
"executionEnvironment": {
"enabled": false,
"containerEngine": "auto",
"containerOptions": "",
"image": "ghcr.io/ansible/creator-ee:latest",
"pull": {
"arguments": "",
"policy": "missing"
},
"volumeMounts": []
}
}
}
}
[Trace - 4:45:50 PM] Received request 'client/registerCapability - (1)'.
Params: {
"registrations": [
{
"id": "b66fd9e7-6240-4ee3-af90-a8d9f016c955",
"method": "workspace/didChangeWorkspaceFolders",
"registerOptions": {}
}
]
}
[Trace - 4:45:50 PM] Sending response 'client/registerCapability - (1)'. Processing request took 1ms
No result returned.
[Trace - 4:45:50 PM] Received request 'client/registerCapability - (2)'.
Params: {
"registrations": [
{
"id": "bd7e53cd-1162-4c72-9292-b52ec3d1c4db",
"method": "workspace/didChangeWatchedFiles",
"registerOptions": {
"watchers": [
{
"globPattern": "**/ansible.cfg"
},
{
"globPattern": "**/.ansible-lint"
},
{
"globPattern": "**/meta/main.{yml,yaml}"
}
]
}
}
]
}
[Trace - 4:45:50 PM] Sending response 'client/registerCapability - (2)'. Processing request took 1ms
No result returned.
[Trace - 4:45:50 PM] Received request 'workspace/configuration - (3)'.
Params: {
"items": [
{
"scopeUri": "file:///home/bcook254/Projects/infra/mailserver.yml",
"section": "ansible"
}
]
}
[Trace - 4:45:50 PM] Sending response 'workspace/configuration - (3)'. Processing request took 2ms
Result: [
{
"ansible": {
"path": "ansible",
"useFullyQualifiedCollectionNames": true,
"reuseTerminal": false
},
"python": {
"interpreterPath": "python3",
"activationScript": ""
},
"ansibleNavigator": {
"path": "ansible-navigator"
},
"completion": {
"provideRedirectModules": true,
"provideModuleOptionAliases": true
},
"validation": {
"enabled": true,
"lint": {
"enabled": true,
"path": "ansible-lint",
"arguments": ""
}
},
"executionEnvironment": {
"enabled": false,
"containerEngine": "auto",
"containerOptions": "",
"image": "ghcr.io/ansible/creator-ee:latest",
"pull": {
"arguments": "",
"policy": "missing"
},
"volumeMounts": []
}
}
]
[Trace - 4:45:50 PM] Received request 'workspace/configuration - (4)'.
Params: {
"items": [
{
"scopeUri": "file:///home/bcook254/Projects/infra",
"section": "ansible"
}
]
}
[Trace - 4:45:50 PM] Sending response 'workspace/configuration - (4)'. Processing request took 1ms
Result: [
{
"ansible": {
"path": "ansible",
"useFullyQualifiedCollectionNames": true,
"reuseTerminal": false
},
"python": {
"interpreterPath": "python3",
"activationScript": ""
},
"ansibleNavigator": {
"path": "ansible-navigator"
},
"completion": {
"provideRedirectModules": true,
"provideModuleOptionAliases": true
},
"validation": {
"enabled": true,
"lint": {
"enabled": true,
"path": "ansible-lint",
"arguments": ""
}
},
"executionEnvironment": {
"enabled": false,
"containerEngine": "auto",
"containerOptions": "",
"image": "ghcr.io/ansible/creator-ee:latest",
"pull": {
"arguments": "",
"policy": "missing"
},
"volumeMounts": []
}
}
]
Path for lint: /home/bcook254/.local/bin/ansible-lint
Validating using ansible-lint
[Trace - 4:45:50 PM] Received request 'window/workDoneProgress/create - (5)'.
Params: {
"token": "02896cc5-d0a0-4360-8496-8b5e66567e49"
}
[Trace - 4:45:50 PM] Sending response 'window/workDoneProgress/create - (5)'. Processing request took 0ms
No result returned.
[Trace - 4:45:50 PM] Received notification '$/progress'.
Params: {
"token": "02896cc5-d0a0-4360-8496-8b5e66567e49",
"value": {
"kind": "begin",
"title": "ansible-lint",
"message": "Processing files..."
}
}
[Trace - 4:45:50 PM] Sending notification '$/setTrace'.
Params: {
"value": "verbose"
}
[Trace - 4:45:50 PM] Sending notification 'update/ansible-metadata'.
Params: [
[
"file:///home/bcook254/Projects/infra/mailserver.yml"
]
]
[Trace - 4:45:50 PM] Sending notification '$/setTrace'.
Params: {
"value": "verbose"
}
[Trace - 4:45:50 PM] Sending notification 'update/ansible-metadata'.
Params: [
[
"file:///home/bcook254/Projects/infra/mailserver.yml"
]
]
[Trace - 4:45:50 PM] Sending notification '$/setTrace'.
Params: {
"value": "verbose"
}
[Trace - 4:45:50 PM] Sending notification 'update/ansible-metadata'.
Params: [
[
"file:///home/bcook254/Projects/infra/mailserver.yml"
]
]
[Trace - 4:45:51 PM] Sending request 'textDocument/semanticTokens/full - (1)'.
Params: {
"textDocument": {
"uri": "file:///home/bcook254/Projects/infra/mailserver.yml"
}
}
[Trace - 4:45:51 PM] Sending request 'textDocument/hover - (2)'.
Params: {
"textDocument": {
"uri": "file:///home/bcook254/Projects/infra/mailserver.yml"
},
"position": {
"line": 15,
"character": 24
}
}
[Trace - 4:45:51 PM] Sending notification '$/setTrace'.
Params: {
"value": "verbose"
}
[Trace - 4:45:51 PM] Sending notification 'update/ansible-metadata'.
Params: [
[
"file:///home/bcook254/Projects/infra/mailserver.yml"
]
]
[Trace - 4:45:51 PM] Sending notification 'update/ansible-metadata'.
Params: [
[
"file:///home/bcook254/Projects/infra/mailserver.yml"
]
]
[Trace - 4:45:53 PM] Sending notification '$/cancelRequest'.
Params: {
"id": 2
}
[Trace - 4:45:54 PM] Received notification '$/progress'.
Params: {
"token": "02896cc5-d0a0-4360-8496-8b5e66567e49",
"value": {
"kind": "end"
}
}
[Trace - 4:45:54 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/bcook254/Projects/infra/mailserver.yml",
"diagnostics": [
{
"message": "Jinja2 spacing could be improved: -{{ nginx_redhat_version }}.{{ (ansible_facts['distribution']=='Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx -> -{{ nginx_redhat_version }}.{{ (ansible_facts['distribution'] == 'Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx",
"range": {
"start": {
"line": 23,
"character": 0
},
"end": {
"line": 23,
"character": 2147483647
}
},
"severity": 1,
"source": "ansible-lint",
"code": "jinja[spacing]",
"codeDescription": {
"href": "https://ansible-lint.readthedocs.io/rules/jinja/"
}
},
{
"message": "Shells that use pipes should set the pipefail option.",
"range": {
"start": {
"line": 25,
"character": 0
},
"end": {
"line": 25,
"character": 2147483647
}
},
"severity": 1,
"source": "ansible-lint",
"code": "risky-shell-pipe",
"codeDescription": {
"href": "https://ansible-lint.readthedocs.io/rules/risky-shell-pipe/"
}
}
]
}