question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No fallback to syntax-check when ansible-lint shows invalid yaml

See original GitHub issue

Problem

When I’m working on ansible roles in vscode, and I have autosave enabled after a relatively short delay (like 1 second), ansible-lint get’s triggered before I’m actually done with my change.

This results in 2 notifications: image

The error is about invalid yaml content, which is true - in that moment.

Solution

There is no need to fall back to ansible syntax-check if a usable ansible-lint is in place. Imo, a fallback should only happen if there’s either no ansible-lint, or the installed one can’t be used for whatever reason.

Instead of having 2 notifications, I’d prefer to have a more silent message, for example in the status bar telling me about broken yaml.

Alternatives

No response

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:25 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rgrunbercommented, Oct 7, 2022

For vscode-yaml, I think the issue is at https://github.com/redhat-developer/vscode-yaml/blob/main/Jenkinsfile#L48 . This is the only place I see the --pre-release flag used, and it only publishes a generic version on platforms that aren’t supported, but there’s nothing published for the other (supported?) platforms. If vscode-yaml doesn’t publish platform-specific code (I think that’s the case?), then there’s no need for this. You could probably remove --target win32-ia32 win32-arm64 linux-armhf alpine-x64 alpine-arm64.

0reactions
max06commented, Oct 26, 2022

@yaegassy I think you’re right.

[{
	"resource": "/workspaces/redacted/ansible/roles/testing/tasks/main.yml",
	"owner": "_generated_diagnostic_collection_name_#1",
	"code": {
		"value": "load-failure",
		"target": {
			"$mid": 1,
			"external": "https://ansible-lint.readthedocs.io/rules/load-failure/",
			"path": "/rules/load-failure/",
			"scheme": "https",
			"authority": "ansible-lint.readthedocs.io"
		}
	},
	"severity": 8,
	"message": "Failed to load YAML file",
	"source": "ansible-lint",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 2147483648
}]

Latest ansible and lint are no longer showing the red error notification. Time to update… yay. Thx again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

syntax-check — Ansible Lint Documentation - Read the Docs
This is a valid approach for special cases, like testing fixtures that are invalid on purpose. One of the most common sources of...
Read more >
Check your YAML for errors with yamllint - Red Hat
The yamllint command is an invaluable tool when you write YAML. It misses some Ansible-specific warnings, but it's a good fallback command for ......
Read more >
ansible-lint Changelog - PyUp.io
Improve errors with invalid yaml files (2589) ssbarnea - Avoid jinja[invalid] with vars on task ... Refactor parsing of ansible syntax check (2529)...
Read more >
Ansible 2.2 Documentation - Read the Docs
This may be confusing when you expect your playbook to not show any ... Empty variables and variables set to null in yaml...
Read more >
プレイブックをチェック : lint|Ansible の使い方 - Zenn
git がインストールされていない環境に ansible-lint をインストール ... description │ Linter failed to process a YAML file, possible not an ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found