Skip to content

Commit

Permalink
avoid calling File.basename twice
Browse files Browse the repository at this point in the history
  • Loading branch information
timfel committed Oct 24, 2010
1 parent 2848dc7 commit 9b81ca8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/syntax_check/ruby.rb
Expand Up @@ -7,12 +7,13 @@ class Ruby < Checker

def check(*args)
path = manifest_path(doc)
file = File.basename(path)
runtime = org.jruby.Ruby.global_runtime
io = java.io.FileInputStream.new(java.io.File.new(path))
begin
runtime.parse_from_main(io, File.basename(path))
runtime.parse_from_main(io, file)
rescue SyntaxError => e
create_syntax_error(doc, e.exception.message, File.basename(path)).annotate
create_syntax_error(doc, e.exception.message, file).annotate
end
end

Expand Down

0 comments on commit 9b81ca8

Please sign in to comment.