class RailsAiAdmin::Templates::Inspector
Constants
- Finding
- MAX_ENTRIES
- MAX_FILES
Public Class Methods
Source
# File lib/rails_ai_admin/templates/inspector.rb, line 14 def initialize(root:, catalog: Catalog.new, max_files: MAX_FILES, max_entries: MAX_ENTRIES) unless max_files.is_a?(Integer) && max_files.between?(1, MAX_FILES) && max_entries.is_a?(Integer) && max_entries.between?(1, MAX_ENTRIES) raise ConfigurationError, "Override inspection bounds may only narrow the defaults" end @root, @catalog = Pathname.new(root).realpath, catalog @max_files, @max_entries = max_files, max_entries end
Public Instance Methods
Source
# File lib/rails_ai_admin/templates/inspector.rb, line 22 def checks @findings, @visited, @files = [], 0, 0 catch(:limit) do %w[rails_ai_admin layouts/rails_ai_admin].each do |namespace| path = @root.join("app/views", namespace) begin SafePaths.check!(@root, path) next unless path.exist? raise ConfigurationError unless path.directory? walk(path) rescue ConfigurationError, SystemCallError @findings << Finding.new(namespace, :error, "UNSAFE_PATH", "app/views/#{namespace}", nil) end end end @findings.sort_by(&:key).freeze end