Class: Bullematic::Fixer
- Inherits:
-
Object
- Object
- Bullematic::Fixer
- Defined in:
- lib/bullematic/fixer.rb,
sig/generated/bullematic/fixer.rbs
Class Method Summary collapse
-
.apply_fixes ⇒ Hash[Symbol, Integer]
: () -> Hash[Symbol, Integer].
-
.clear ⇒ void
: () -> void.
-
.detection_queue ⇒ Array[Detection]
: () -> Array.
- .queue(detection) ⇒ void
Class Method Details
.apply_fixes ⇒ Hash[Symbol, Integer]
: () -> Hash[Symbol, Integer]
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/bullematic/fixer.rb', line 35 def apply_fixes logger = BullematicLogger.new pending = drain_queue return logger.stats if pending.empty? grouped = pending.group_by(&:source_file) grouped.each do |filepath, detections| unless filepath detections.each { |detection| logger.log_skip("(unknown)", detection, "source unavailable") } next end process_file(filepath, detections, logger) rescue ParseError, FixError => e logger.log_error(filepath, e) rescue StandardError => e logger.log_error(filepath, e) raise if Bullematic.configuration&.debug end logger.log_summary logger.stats end |
.clear ⇒ void
This method returns an undefined value.
: () -> void
30 31 32 |
# File 'lib/bullematic/fixer.rb', line 30 def clear queue_mutex.synchronize { @detection_queue = [] } end |
.detection_queue ⇒ Array[Detection]
: () -> Array
12 13 14 |
# File 'lib/bullematic/fixer.rb', line 12 def detection_queue queue_mutex.synchronize { queue_store.dup } end |
.queue(detection) ⇒ void
This method returns an undefined value.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bullematic/fixer.rb', line 18 def queue(detection) if EvidenceStore.recording? EvidenceStore.append(detection) return end queue_mutex.synchronize do queue_store << detection unless queue_store.any? { |queued| queued.fingerprint == detection.fingerprint } end end |