class PreCommit::Checks::Checkstyle

Public Class Methods

description() click to toggle source
# File lib/plugins/pre_commit/checks/checkstyle.rb, line 31
def self.description
  'Runs coffeelint to detect errors'
end

Public Instance Methods

alternate_config_file() click to toggle source
# File lib/plugins/pre_commit/checks/checkstyle.rb, line 27
def alternate_config_file
  support_path('sun_checks.xml')
end
call(staged_files) click to toggle source
# File lib/plugins/pre_commit/checks/checkstyle.rb, line 6
def call(staged_files)
  staged_files = staged_files.grep(/\.java$/)
  return if staged_files.empty?

  args = (jar_flag + config_file_flag + staged_files).join(' ')

  execute("java #{args}")
end
config_file_flag() click to toggle source
# File lib/plugins/pre_commit/checks/checkstyle.rb, line 23
def config_file_flag
  config_file ? ['-c', config_file] : []
end
jar_flag() click to toggle source
# File lib/plugins/pre_commit/checks/checkstyle.rb, line 15
def jar_flag
  ['-jar', support_path('checkstyle-5.7-all.jar')]
end
support_path(file) click to toggle source
# File lib/plugins/pre_commit/checks/checkstyle.rb, line 19
def support_path(file)
  File.expand_path("../../../../pre-commit/support/checkstyle/#{file}", __FILE__)
end