Class: Danger::PluginLint
- Inherits:
-
CLAide::Command::Plugins
- Object
- CLAide::Command::Plugins
- Danger::PluginLint
- Defined in:
- lib/danger/commands/plugins/plugin_lint.rb
Instance Attribute Summary collapse
-
#cork ⇒ Object
Returns the value of attribute cork.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ PluginLint
constructor
A new instance of PluginLint.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ PluginLint
Returns a new instance of PluginLint.
12 13 14 15 16 17 18 |
# 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 |
Instance Attribute Details
#cork ⇒ Object
Returns the value of attribute cork.
10 11 12 |
# File 'lib/danger/commands/plugins/plugin_lint.rb', line 10 def cork @cork end |
Class Method Details
.options ⇒ Object
32 33 34 35 36 |
# File 'lib/danger/commands/plugins/plugin_lint.rb', line 32 def self. [ ["--warnings-as-errors", "Ensure strict linting."] ].concat(super) end |
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/danger/commands/plugins/plugin_lint.rb', line 38 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 |