Object
# File lib/puppet-lint.rb, line 96 def code=(value) @data = value end
# File lib/puppet-lint.rb, line 83 def configuration self.class.configuration end
# File lib/puppet-lint.rb, line 141 def errors? @statistics[:error] != 0 end
# File lib/puppet-lint.rb, line 87 def file=(path) if File.exist? path @fileinfo[:path] = path @fileinfo[:fullpath] = File.expand_path(path) @fileinfo[:filename] = File.basename(path) @data = File.read(path) end end
# File lib/puppet-lint.rb, line 112 def format_message(message) format = log_format puts format % message end
# File lib/puppet-lint.rb, line 100 def log_format if configuration.log_format == '' ## recreate previous old log format as far as thats possible. format = '%{KIND}: %{message} on line %{linenumber}' if configuration.with_filename format.prepend '%{path} - ' end configuration.log_format = format end return configuration.log_format end
# File lib/puppet-lint.rb, line 117 def print_context(message, linter) # XXX: I don't really like the way this has been implemented (passing the # linter object down through layers of functions. Refactor me! return if message[:check] == 'documentation' line = linter.manifest_lines[message[:linenumber] - 1] offset = line.index(/\S/) puts "\n #{line.strip}" printf "%#{message[:column] + 2 - offset}s\n\n", '^' end
# File lib/puppet-lint.rb, line 127 def report(problems, linter) problems.each do |message| @statistics[message[:kind]] += 1 ## Add some default attributes. message.merge!(@fileinfo) {|key, v1, v2| v1 } message[:KIND] = message[:kind].to_s.upcase if configuration.error_level == message[:kind] or configuration.error_level == :all format_message message print_context(message, linter) if configuration.with_context end end end
Generated with the Darkfish Rdoc Generator 2.