Class: Rigor::ModuleGraph::Plugin
- Inherits:
-
Plugin::Base
- Object
- Plugin::Base
- Rigor::ModuleGraph::Plugin
- Defined in:
- lib/rigor/module_graph/plugin/rigor_plugin.rb
Overview
Rigor plugin: declares the node rules that emit class/module/ constant dependency edges as ‘:info` diagnostics. Loaded only when `rigortype` is available (see `plugin.rb`).
Instance Method Summary collapse
- #analyzer_for(scope, path, context, visibility_map) ⇒ Object
- #edge_diagnostic(edge, node) ⇒ Object
- #node_diagnostic(meta, ast_node) ⇒ Object
- #zeitwerk_resolver ⇒ Object
Instance Method Details
#analyzer_for(scope, path, context, visibility_map) ⇒ Object
105 106 107 108 109 110 111 112 113 |
# File 'lib/rigor/module_graph/plugin/rigor_plugin.rb', line 105 def analyzer_for(scope, path, context, visibility_map) Analyzer.new( path: path, context: context, scope: scope, zeitwerk: zeitwerk_resolver, visibility_map: visibility_map ) end |
#edge_diagnostic(edge, node) ⇒ Object
127 128 129 130 131 132 133 134 135 |
# File 'lib/rigor/module_graph/plugin/rigor_plugin.rb', line 127 def edge_diagnostic(edge, node) diagnostic( node, path: edge.path, message: JSON.generate(edge.), severity: :info, rule: EDGE_RULE ) end |
#node_diagnostic(meta, ast_node) ⇒ Object
137 138 139 140 141 142 143 144 145 |
# File 'lib/rigor/module_graph/plugin/rigor_plugin.rb', line 137 def node_diagnostic(, ast_node) diagnostic( ast_node, path: .path, message: JSON.generate(.), severity: :info, rule: NODE_RULE ) end |
#zeitwerk_resolver ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/rigor/module_graph/plugin/rigor_plugin.rb', line 115 def zeitwerk_resolver return @zeitwerk_resolver if defined?(@zeitwerk_resolver) @zeitwerk_resolver = if config["rails_zeitwerk"] ZeitwerkResolver.new( autoload_paths: config["autoload_paths"], concern_dirs: config["concern_dirs"] ) end end |