-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrequire_missing.rb
More file actions
executable file
·34 lines (28 loc) · 903 Bytes
/
Copy pathrequire_missing.rb
File metadata and controls
executable file
·34 lines (28 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env ruby
require_relative './rurema_source_code_linter'
require 'fileutils'
require 'yaml'
linter = RuremaSourceCodeLinter.new
error_rds = []
rurema_path = File.expand_path("~/.bitclust/rubydoc/")
rd_pattern = "refm/**/*"
Dir.chdir(rurema_path)
Dir[rd_pattern].each do |rd|
next if rd.include?('/capi/')
next if rd.include?('/_builtin/')
next if File.directory?(rd)
begin
error_codes = linter.lint(rd) do |s|
!s.include?('require') && !s.match(/^$? *ruby /)
end
next if error_codes.empty?
error_code_path = File.join(rurema_path, 'error_codes', rd) + '.yml'
FileUtils.mkdir_p(File.dirname(error_code_path))
File.write(error_code_path, error_codes.to_yaml)
rescue
$stderr.puts $!.message
error_rds << rd
end
end
error_rd_path = File.join(rurema_path, 'error_rds.yml')
File.write(error_rd_path, error_rds.to_yaml) unless error_rds.empty?