Top Level Namespace
Defined Under Namespace
Modules: RailsErbCheck, RailsErbLint
Instance Method Summary
collapse
Instance Method Details
#check_files(erbs, options) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/rails-erb-lint/linter/check_validity.rb', line 28
def check_files(erbs, options)
files = {}
erbs.each do |f|
checker = RailsErbCheck::Checker.new(f)
if checker.valid_syntax?
puts Rainbow("#{f} => valid").green if options[:valid]
files[f] = { invalid: false }
else
puts Rainbow("#{f} => invalid").red
puts checker.error.message if options[:error]
files[f] = {
invalid: true,
error: checker.error.message,
backtrace: checker.error.backtrace
}
end
end
files
end
|
#export_json(hash, path) ⇒ Object
51
52
53
54
55
|
# File 'lib/rails-erb-lint/linter/check_validity.rb', line 51
def export_json(hash, path)
File.open(path, 'w') do |file|
JSON.dump(hash, file)
end
end
|
#get_erb_list(path) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/rails-erb-lint/linter/check_validity.rb', line 15
def get_erb_list(path)
erb_files = []
Find.find(path.to_s) do |f|
next if FileTest.directory?(f)
if /.*\.erb/.match(File.basename(f))
erb_files << f
end
end
erb_files
end
|