Skip to content

Commit

Permalink
Suppress invalid html errors (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyhansonfinger committed Oct 11, 2016
1 parent e10ea84 commit 3288f8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
7 changes: 3 additions & 4 deletions lib/erb_lint/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@ def restore_erb_tags(file_tree, seed)
# in the future we would ideally parse out the erb tags into real nodes and assign line numbers
end

def ensure_valid_tree(file_tree)
if file_tree.children.empty? || file_tree.children.last.name != END_MARKER_NAME
raise ParseError, 'File could not be successfully parsed. Ensure all tags are properly closed.'
end
# Temporarily suppressing invalid HTML errors because nokogiri is raising lots of false positives
def ensure_valid_tree(_file_tree)
true
end
end

Expand Down
13 changes: 0 additions & 13 deletions spec/erb_lint/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,6 @@
end
end
end

context 'when tags are not properly closed' do
let(:file) { <<~FILE.chomp }
<div>
FILE

it 'raises a general parsing error' do
expect { described_class.parse(file) }.to raise_error(
described_class::ParseError,
'File could not be successfully parsed. Ensure all tags are properly closed.'
)
end
end
end

describe '#file_is_empty?' do
Expand Down

0 comments on commit 3288f8e

Please sign in to comment.