class Danger::Changelog::ChangelogFile
A CHANGELOG.md file reader.
Attributes
bad_lines[R]
exists[R]
filename[R]
global_failures[R]
Public Class Methods
new(filename = 'CHANGELOG.md', parser: Parsers.lookup(Parsers.default_format))
click to toggle source
# File lib/changelog/changelog_file.rb, line 7 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
Public Instance Methods
add_bad_line(line, detail = nil)
click to toggle source
# File lib/changelog/changelog_file.rb, line 17 def add_bad_line(line, detail = nil) return unless line || detail @bad_lines << [line, detail].compact end
add_global_failure(message)
click to toggle source
# File lib/changelog/changelog_file.rb, line 23 def add_global_failure(message) @global_failures << message end
bad?()
click to toggle source
# File lib/changelog/changelog_file.rb, line 46 def bad? bad_lines? || global_failures? end
bad_lines?()
click to toggle source
Any bad_lines
?
# File lib/changelog/changelog_file.rb, line 34 def bad_lines? bad_lines.any? end
exists?()
click to toggle source
# File lib/changelog/changelog_file.rb, line 42 def exists? @exists end
global_failures?()
click to toggle source
# File lib/changelog/changelog_file.rb, line 38 def global_failures? global_failures.any? end
good?()
click to toggle source
# File lib/changelog/changelog_file.rb, line 50 def good? !bad? end
parse()
click to toggle source
# File lib/changelog/changelog_file.rb, line 27 def parse return unless exists? @parser.parse(filename) end