Class: Syntaxer::RepoChecker
Overview
Check status of files in repository
Instance Attribute Summary
Attributes inherited from Checker
Instance Method Summary collapse
-
#initialize(syntaxer) ⇒ RepoChecker
constructor
A new instance of RepoChecker.
-
#process ⇒ Object
Check syntax in repository directory.
Methods inherited from Checker
Constructor Details
#initialize(syntaxer) ⇒ RepoChecker
Returns a new instance of RepoChecker.
66 67 68 |
# File 'lib/syntaxer/checker.rb', line 66 def initialize syntaxer super syntaxer, syntaxer.repository.changed_and_added_files.length end |
Instance Method Details
#process ⇒ Object
Check syntax in repository directory
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/syntaxer/checker.rb', line 74 def process checked_files = Set.new rule_files = {} @reader.rules.each do |rule| rule_files[rule.name] = {} rule_files[rule.name][:rule] = rule rule_files[rule.name][:files] = [] rule.extensions.each do |ext| files.each do |file| if File.extname(file).gsub(/\./,'') == ext || \ (!rule.specific_files.nil? && !rule_files[rule.name][:files].include?(file) && rule.specific_files.include?(file)) rule_files[rule.name][:files].push(file) end end end end rule_files.each do |rule_name, rule| rule[:files].each do |file| full_path = File.join(@syntaxer.root_path,file) check(rule[:rule], full_path) end end self end |