Use jasmine.undefined for all comparisons to the undefined value, since undefined itself may be redefined elsewhere

in app code.  Thanks to Charlie Meyer at UIUC for the suggestion.
This commit is contained in:
Christian Williams
2009-11-26 11:12:06 -05:00
parent 2cb5bf146c
commit 7653107f0c
14 changed files with 100 additions and 59 deletions

View File

@@ -34,8 +34,29 @@ namespace :jasmine do
desc 'Prepares for distribution'
task :dist => ['jasmine:build', 'jasmine:doc']
desc 'Check jasmine sources for coding problems'
task :lint do
passed = true
jasmine_sources.each do |src|
lines = File.read(src).split(/\n/)
lines.each_index do |i|
line = lines[i]
undefineds = line.scan(/.?undefined/)
if undefineds.include?(" undefined") || undefineds.include?("\tundefined")
puts "Dangerous undefined at #{src}:#{i}:\n > #{line}"
passed = false
end
end
end
unless passed
puts "Lint failed!"
exit 1
end
end
desc 'Builds lib/jasmine from source'
task :build do
task :build => :lint do
puts 'Building Jasmine from source'
require 'json'