class Danger::PluginLint

Attributes

cork[RW]

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/danger/commands/plugins/plugin_lint.rb, line 12
def initialize(argv)
  @warnings_as_errors = argv.flag?("warnings-as-errors", false)
  @refs = argv.arguments! unless argv.arguments.empty?
  @cork = Cork::Board.new(silent: argv.option("silent", false),
                          verbose: argv.option("verbose", false))
  super
end
options() click to toggle source
Calls superclass method
# File lib/danger/commands/plugins/plugin_lint.rb, line 30
def self.options
  [
    ["--warnings-as-errors", "Ensure strict linting."]
  ].concat(super)
end

Public Instance Methods

run() click to toggle source
# File lib/danger/commands/plugins/plugin_lint.rb, line 36
def run
  file_resolver = PluginFileResolver.new(@refs)
  data = file_resolver.resolve

  parser = PluginParser.new(data[:paths], verbose: true)
  parser.parse
  json = parser.to_json

  linter = PluginLinter.new(json)
  linter.lint
  linter.print_summary(cork)

  abort("Failing due to errors\n".red) if linter.failed?
  abort("Failing due to warnings as errors\n".red) if @warnings_as_errors && !linter.warnings.empty?
end