Sha256: deb34ffa96da3c1ce15dbdaab309c426914175425a8ca2db2628e32bc452aedf

Contents?: true

Size: 781 Bytes

Versions: 3

Compression:

Stored size: 781 Bytes

Contents

module Danger
  # Reads undocumented.json file created by jazzy
  class UndocumentedReader
    def initialize(path)
      load(path)
    end

    def undocumented_symbols
      @data['warnings'].map do |item|
        next unless item_valid? item
        Symbol.new(
          item_file(item),
          item['line'],
          item['symbol'],
          item['symbol_kind'],
          item['warning']
        )
      end
    end

    private

    def load(path)
      @data = JSON.parse(File.read(path))
      @working_path = Pathname.new(@data['source_directory'])
    end

    def item_file(item)
      path = Pathname.new(item['file'])
      path.relative_path_from(@working_path).to_s
    end

    def item_valid?(item)
      item['warning'] == 'undocumented'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danger-jazzy-1.0.2 lib/jazzy/undocumented_reader.rb
danger-jazzy-1.0.0 lib/jazzy/undocumented_reader.rb
danger-jazzy-0.1.1 lib/jazzy/undocumented_reader.rb