Class: RakeDotNet::FxCopTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/rake_dotnet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) {|_self| ... } ⇒ FxCopTask

Returns a new instance of FxCopTask.

Yields:

  • (_self)

Yield Parameters:



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/rake_dotnet.rb', line 414

def initialize(params={})
	@product_name = params[:product_name] || PRODUCT_NAME
	@report_dir = params[:report_dir] || File.join(OUT_DIR, 'reports')
	@name = params[:name] || File.join(@report_dir, @product_name + '.fxcop')
	@suites_dir = params[:suites_dir] || File.join(OUT_DIR, 'bin')
	@dll_list = FileList.new
	@deps = params[:deps] || []
	@fxcop_options = params[:fxcop_options] || {}
	if @fxcop_options[:apply_out_xsl].nil? || @fxcop_options[:apply_out_xsl] == false
		@name += '.xml'
	else
		@name += '.html'
	end
	@fxcop_options[:out_file] = @name if @fxcop_options[:out_file].nil?

	yield self if block_given?
	define
end

Instance Attribute Details

#dll_listObject

Returns the value of attribute dll_list.



412
413
414
# File 'lib/rake_dotnet.rb', line 412

def dll_list
  @dll_list
end

#suites_dirObject

Returns the value of attribute suites_dir.



412
413
414
# File 'lib/rake_dotnet.rb', line 412

def suites_dir
  @suites_dir
end

Instance Method Details

#defineObject



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/rake_dotnet.rb', line 433

def define
	@deps.each do |d|
		task :fxcop => d
	end

	directory @report_dir

	file @name => [@report_dir] do |f|
		runner = FxCopCmd.new(@dll_list, @fxcop_options)
		runner.run
	end

	task :fxcop, [:include_globs, :exclude_globs] do |t, args|
		args.with_defaults(:include_globs => ["#{@suites_dir}/**/*#{@product_name}*.dll", "#{@suites_dir}/**/*#{@product_name}*.exe"])
		args.include_globs.each do |g|
			@dll_list.include g
		end
		args.with_defaults(:exclude_globs => ["#{@suites_dir}/*Tests*.dll", "#{@suites_dir}/*.vshost.exe"])
		args.exclude_globs.each do |g|
			@dll_list.exclude g
		end
		Rake::FileTask[@name].invoke
	end

	task :clobber_fxcop, [:globs] do |t, args|
		rm_rf @report_dir
	end

	self
end