Class: XRay::JS::Rule::FileChecker

Inherits:
Object
  • Object
show all
Includes:
Helper, Rule
Defined in:
lib/js/rule/file_checker.rb

Constant Summary

Constants included from Rule

Rule::KEYWORDS, Rule::RULE_PATH, Rule::STYLE_TYPES

Instance Method Summary collapse

Methods included from Helper

#app, #find_expr_member, #func_file?, #global_scope?, #grep_import_js_path, #has_doc_comment?, #lib_scope?, #merge_file?, #min_file?, #page_scope?, #readfile, #relative?, #results_to_logs, #scope

Methods included from Rule

#add_common_rule, #clear_all_rules, #cmd_name, #common, #context, #do_check, #import, import_all, #import_all, #imported, #imported?, #method_missing, methods_to_keywords, #syntax

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class XRay::Rule

Instance Method Details

#check_file(path) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/js/rule/file_checker.rb', line 16

def check_file(path)
  src = readfile(path)
  ret = results_to_logs check_js_file( path, src )

  if merge_file? path
    pathes = grep_import_js_path( src )
    ret.concat results_to_logs( check_js_merge_file( path, src, pathes ) )
    ret.concat results_to_logs( check_merge_imports( pathes, path ) )
  end
  ret
end

#check_merge_imports(pathes, path) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/js/rule/file_checker.rb', line 28

def check_merge_imports( pathes, path )
  ret = []
  pathes.each do |import|
    r = check_js_merge_importing import, pathes, path
    ret.concat r
  end
  ret
end