class Buildr::Checkstyle::Config

Attributes

additional_project_names[W]

An array of additional projects to scan for main and test sources

config_directory[W]
configuration_file[W]
enabled[W]
fail_on_error[W]
format[W]
html_output_file[W]
import_control_file[W]
java_args[W]

An array of additional java_args

project[R]
report_dir[W]
style_file[W]
suppressions_file[W]
xml_output_file[W]

Public Class Methods

new(project) click to toggle source
# File addon/buildr/checkstyle.rb, line 202
def initialize(project)
  @project = project
end

Public Instance Methods

additional_project_names() click to toggle source
# File addon/buildr/checkstyle.rb, line 185
def additional_project_names
  @additional_project_names ||= []
end
complete_source_paths() click to toggle source
# File addon/buildr/checkstyle.rb, line 189
def complete_source_paths
  paths = self.source_paths.dup

  self.additional_project_names.each do |project_name|
    p = self.project.project(project_name)
    paths << [p.compile.sources, p.test.compile.sources].flatten.compact
  end

  paths.flatten.compact
end
config_directory() click to toggle source
# File addon/buildr/checkstyle.rb, line 70
def config_directory
  @config_directory || project._(:source, :main, :etc, :checkstyle)
end
configuration_artifact() click to toggle source
# File addon/buildr/checkstyle.rb, line 104
def configuration_artifact
  @configuration_artifact
end
configuration_artifact=(configuration_artifact) click to toggle source
# File addon/buildr/checkstyle.rb, line 99
def configuration_artifact=(configuration_artifact)
  raise 'Configuration file already specified' if @configuration_file
  @configuration_artifact = configuration_artifact
end
configuration_file() click to toggle source
# File addon/buildr/checkstyle.rb, line 87
def configuration_file
  if @configuration_file
    return @configuration_file
  elsif @configuration_artifact.nil?
    "#{self.config_directory}/checks.xml"
  else
    a = Buildr.artifact(@configuration_artifact)
    a.invoke
    a.to_s
  end
end
enabled?() click to toggle source
# File addon/buildr/checkstyle.rb, line 60
def enabled?
  @enabled.nil? ? (File.exist?(self.configuration_file) || !self.configuration_artifact.nil?) : !!@enabled
end
extra_dependencies() click to toggle source
# File addon/buildr/checkstyle.rb, line 171
def extra_dependencies
  @extra_dependencies ||= []
end
fail_on_error?() click to toggle source
# File addon/buildr/checkstyle.rb, line 110
def fail_on_error?
  @fail_on_error.nil? ? false : @fail_on_error
end
format() click to toggle source
# File addon/buildr/checkstyle.rb, line 116
def format
  @format || 'xml'
end
html_enabled?() click to toggle source
# File addon/buildr/checkstyle.rb, line 64
def html_enabled?
  File.exist?(self.style_file)
end
html_output_file() click to toggle source
# File addon/buildr/checkstyle.rb, line 128
def html_output_file
  @html_output_file || "#{self.report_dir}/checkstyle.html"
end
import_control_file() click to toggle source
# File addon/buildr/checkstyle.rb, line 154
def import_control_file
  @import_control_file || "#{self.config_directory}/import-control.xml"
end
java_args() click to toggle source
# File addon/buildr/checkstyle.rb, line 178
def java_args
  @java_args ||= []
end
properties() click to toggle source
# File addon/buildr/checkstyle.rb, line 158
def properties
  unless @properties
    @properties = {:basedir => self.project.base_dir}
    @properties['checkstyle.suppressions.file'] = self.suppressions_file if File.exist?(self.suppressions_file)
    @properties['checkstyle.import-control.file'] = self.import_control_file if File.exist?(self.import_control_file)
  end
  @properties
end
report_dir() click to toggle source
# File addon/buildr/checkstyle.rb, line 76
def report_dir
  @report_dir || project._(:reports, :checkstyle)
end
source_paths() click to toggle source
# File addon/buildr/checkstyle.rb, line 167
def source_paths
  @source_paths ||= [self.project.compile.sources, self.project.test.compile.sources]
end
style_file() click to toggle source
# File addon/buildr/checkstyle.rb, line 134
def style_file
  unless @style_file
    project_xsl = "#{self.config_directory}/checkstyle-report.xsl"
    if File.exist?(project_xsl)
      @style_file = project_xsl
    else
      @style_file = "#{File.dirname(__FILE__)}/checkstyle-report.xsl"
    end
  end
  @style_file
end
suppressions_file() click to toggle source
# File addon/buildr/checkstyle.rb, line 148
def suppressions_file
  @suppressions_file || "#{self.config_directory}/suppressions.xml"
end
xml_output_file() click to toggle source
# File addon/buildr/checkstyle.rb, line 122
def xml_output_file
  @xml_output_file || "#{self.report_dir}/checkstyle.xml"
end