Class: Textus::Doctor::Check::NotebookSources

Inherits:
Textus::Doctor::Check show all
Defined in:
lib/textus/doctor/check/notebook_sources.rb

Instance Method Summary collapse

Methods inherited from Textus::Doctor::Check

#initialize, name_key

Constructor Details

This class inherits a constructor from Textus::Doctor::Check

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/textus/doctor/check/notebook_sources.rb', line 5

def call
  issues = []
  manifest.resolver.enumerate.each do |row|
    next unless row[:key].start_with?("notebook.notes.")
    next unless row[:path] && File.exist?(row[:path])

    sources = parse_sources(row[:path])
    sources.each do |raw_key|
      next if raw_entry_exists?(raw_key)

      issues << {
        "code" => "notebook.source_missing",
        "level" => "warning",
        "subject" => row[:key],
        "message" => "notebook entry '#{row[:key]}' references raw key '#{raw_key}' " \
                     "which does not exist in the store",
        "fix" => "re-ingest the source: textus ingest ..., or remove the stale sources: entry",
      }
    end
  end
  issues
end