Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
make warnings from the validator available rather then ignoring them
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Jun 29, 2016
1 parent 0ecc4bf commit cb1fbe2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,17 @@ module.exports =
messages = @parseSchematronMessages(textEditor, output)
else
messages = @parseSchemaMessages(textEditor, output)
for message in messages
message.type = 'Error'
message.text = message.text + ' (' + schemaUrl + ')'
message.filePath = textEditor.getPath()
if messages.length
for message in messages
message.type = 'Error'
message.text = message.text + ' (' + schemaUrl + ')'
message.filePath = textEditor.getPath()
else if output.indexOf('- validates') is -1
messages.push({
type: 'Error'
text: output
filePath: textEditor.getPath()
})
return messages

parseMessages: (output) ->
Expand Down
8 changes: 8 additions & 0 deletions spec/fixtures/invalid/xml-model-unavailable.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<?xml-model href="../unavailable.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<note xmlns="http://www.w3schools.com">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
6 changes: 6 additions & 0 deletions spec/linter-xmllint-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ describe 'The xmllint provider for Linter', ->
return lint(editor).then (messages) ->
expect(messages.length).toEqual 1
expect(messages[0].range).toEqual [[3, 2], [3, 21]]
waitsForPromise ->
return atom.workspace.open(__dirname + '/fixtures/invalid/xml-model-unavailable.xml').then (editor) ->
return lint(editor).then (messages) ->
expect(messages.length).toEqual 1
expect(messages[0].range).toEqual undefined
expect(messages[0].text).toContain 'unavailable.xsd'
waitsForPromise ->
return atom.workspace.open(__dirname + '/fixtures/invalid/relax-errors.xml').then (editor) ->
return lint(editor).then (messages) ->
Expand Down

0 comments on commit cb1fbe2

Please sign in to comment.