lib/danger/plugin_support/plugin_linter.rb in danger-0.10.1 vs lib/danger/plugin_support/plugin_linter.rb in danger-2.0.0
- old
+ new
@@ -63,18 +63,20 @@
else
ui.notice "Passed"
end
# A generic proc to handle the similarities between
- # erros and warnings.
+ # errors and warnings.
do_rules = proc do |name, rules|
unless rules.empty?
ui.puts ""
ui.section(name.bold) do
rules.each do |rule|
title = rule.title.bold + " - #{rule.object_applied_to}"
- ui.labeled(title, [rule.description, link(rule.ref)])
+ subtitles = [rule.description, link(rule.ref)]
+ subtitles += [rule.metadata[:files].join(":")] if rule.metadata[:files]
+ ui.labeled(title, subtitles)
ui.puts ""
end
end
end
end
@@ -113,11 +115,15 @@
json[:body_md] && json[:body_md].empty?
end),
Rule.new(:warning, 43..45, "Params", "You should give a 'type' for the param, yes, ruby is duck-typey but it's useful for newbies to the language, use `@param [Type] name`.", proc do |json|
json[:param_couplets] && json[:param_couplets].flat_map(&:values).include?(nil)
end),
+ Rule.new(:warning, 43..45, "Unknown Param", "You should give a 'type' for the param, yes, ruby is duck-typey but it's useful for newbies to the language, use `@param [Type] name`.", proc do |json|
+ json[:param_couplets] && json[:param_couplets].flat_map(&:values).include?("Unknown")
+ end),
Rule.new(:warning, 46, "Return Type", "If the function has no useful return value, use ` @return [void]` - this will be ignored by documentation generators.", proc do |json|
- json[:return] && json[:return].empty?
+ return_hash = json[:tags].find { |tag| tag[:name] == "return" }
+ !(return_hash && return_hash[:types] && !return_hash[:types].first.empty?)
end)
]
end
# Generates a link to see an example of said rule