File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -131,9 +131,9 @@ def check
131131 actual = 0
132132 if token . next_token . type == :INDENT
133133 actual = token . next_token . value . length
134- elsif token . prev_token . type == :HEREDOC
134+ elsif ! token . prev_token . nil? and token . prev_token . type == :HEREDOC
135135 actual = token . prev_token . value . split ( "\n " ) . last . length
136- elsif token . prev_token . type == :HEREDOC_OPEN
136+ elsif ! token . prev_token . nil? and token . prev_token . type == :HEREDOC_OPEN
137137 actual = next_token . prev_token . value . split ( "\n " ) . last . length
138138 else
139139 actual = 0
Original file line number Diff line number Diff line change @@ -77,4 +77,17 @@ class (
7777 expect ( problems ) . to have ( 1 ) . problems
7878 end
7979 end
80+
81+ context 'blank line at beginning of file' do
82+ let ( :code ) {
83+ <<-EOF . gsub ( /^ {8}/ , '' )
84+
85+ class () {}
86+ EOF
87+ }
88+
89+ it 'should detect 0 problems' do
90+ expect ( problems ) . to have ( 0 ) . problems
91+ end
92+ end
8093end
You can’t perform that action at this time.
0 commit comments