Sha256: c4c422c73e5bc5248ef896a64f16bfa8c35811b4aa351cc82b57a529df45cfe8
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
module Danger module Changelog # A CHANGELOG.md file reader. class ChangelogFile attr_reader :filename, :bad_lines, :exists, :global_failures def initialize(filename = 'CHANGELOG.md', parser: Parsers.lookup(Parsers.default_format)) @filename = filename @exists = File.exist?(filename) @bad_lines = [] @global_failures = [] @parser = parser parser.add_listener(self) end def add_bad_line(line, detail = nil) return unless line || detail @bad_lines << [line, detail].compact end def add_global_failure(message) @global_failures << message end def parse return unless exists? @parser.parse(filename) end # Any bad_lines? def bad_lines? bad_lines.any? end def global_failures? global_failures.any? end def exists? @exists end def bad? bad_lines? || global_failures? end def good? !bad? end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danger-changelog-0.7.1 | lib/changelog/changelog_file.rb |
danger-changelog-0.7.0 | lib/changelog/changelog_file.rb |
danger-changelog-0.6.1 | lib/changelog/changelog_file.rb |