Skip to content

Commit

Permalink
ignore irrelevant inventory and hosts warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuchard committed Jul 12, 2024
1 parent 50e3395 commit 83e78e1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### 1.3.2 (Next)
- Improve YAML syntax error message parsing.
- Ignore irrelevant inventory and hosts warnings.

bug in pulsar/ide-ui causing issues displaying yaml syntax message
warnings no longer captured randomly
update error-line-col, bad_include, missing_include because syntax-check no longer finding errors in general
diagnostic missing message for temp fixture copied here
task with only name emits uncaptured message

### 1.3.1
- Updates to Linter API usage.
- Fix error catch exec return.
Expand Down
6 changes: 5 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ export default {
output.split(/\r?\n/).forEach((line) => {
// capture the warning
const matchesWarning = /WARNING\]:\s(.*)/.exec(line);
// these are annoying and pointless warnings within an editor
const matchesIgnoreInventory = /No inventory was parsed/.exec(line);
const matchesIgnoreHosts = /provided hosts list is empty/.exec(line);
const matchesIgnorePattern = /not match supplied host pattern/.exec(line);

if (matchesWarning != null) {
if (matchesIgnoreInventory == null && matchesIgnoreHosts == null && matchesIgnorePattern == null && matchesWarning != null) {
toReturn.push({
severity: 'warning',
excerpt: matchesWarning[1] + '.',
Expand Down
3 changes: 2 additions & 1 deletion spec/fixtures/clean.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# No errors from syntax check.
---
- hosts: whatever
- name: Clean fixture
hosts: whatever
tasks:
- name: Hello World
ansible.builtin.debug:
Expand Down

0 comments on commit 83e78e1

Please sign in to comment.