Class: Torikago::Checker
- Inherits:
-
Object
- Object
- Torikago::Checker
- Defined in:
- lib/torikago/checker.rb
Overview
Lightweight static checks for explicit Gateway calls and package API manifests. This is intentionally conservative; runtime enforcement still lives in Gateway.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- CALL_PATTERN =
/ Torikago::Gateway\.call\( \s* ["'](?<class_name>[A-Z][A-Za-z0-9:]+)["'] /x.freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(configuration:, source_roots:) ⇒ Checker
constructor
A new instance of Checker.
Constructor Details
#initialize(configuration:, source_roots:) ⇒ Checker
Returns a new instance of Checker.
27 28 29 30 31 |
# File 'lib/torikago/checker.rb', line 27 def initialize(configuration:, source_roots:) @configuration = configuration @source_roots = Array(source_roots).map { |root| Pathname(root) } @manifests = {} end |
Instance Method Details
#call ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/torikago/checker.rb', line 33 def call errors = [] gateway_call_count = 0 scanned_files = source_files scanned_files.each do |path| gateway_call_count += scan_gateway_calls(path, errors) end manifest_count = 0 configuration.each_definition do |definition| manifest_count += 1 validate_manifest_entries(definition, errors) end Result.new( errors: errors, scanned_file_count: scanned_files.size, gateway_call_count: gateway_call_count, manifest_count: manifest_count ) end |