Class: Bulletproof::Detectors::ExcessiveIncludesDetector
- Inherits:
-
Object
- Object
- Bulletproof::Detectors::ExcessiveIncludesDetector
- Defined in:
- lib/bulletproof/detectors/excessive_includes_detector.rb
Instance Method Summary collapse
- #call(source, file: "(string)") ⇒ Array<Violation>
-
#initialize(config) ⇒ ExcessiveIncludesDetector
constructor
A new instance of ExcessiveIncludesDetector.
Constructor Details
#initialize(config) ⇒ ExcessiveIncludesDetector
Returns a new instance of ExcessiveIncludesDetector.
29 30 31 |
# File 'lib/bulletproof/detectors/excessive_includes_detector.rb', line 29 def initialize(config) @config = config end |
Instance Method Details
#call(source, file: "(string)") ⇒ Array<Violation>
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/bulletproof/detectors/excessive_includes_detector.rb', line 36 def call(source, file: "(string)") processed = RuboCop::AST::ProcessedSource.new(source, RUBY_VERSION.to_f, file) return [] unless processed.valid_syntax? parent_map = build_parent_map(processed.ast) violations = [] collect_includes_nodes(processed.ast).each do |node| check(node, violations, file, parent_map) end violations end |