lib/php_codesniffer/plugin.rb in danger-php_codesniffer-0.1.6 vs lib/php_codesniffer/plugin.rb in danger-php_codesniffer-0.1.7

- old
+ new

@@ -60,16 +60,21 @@ summary["errors"] += totals["errors"] summary["warnings"] += totals.fetch("warnings") summary["fixable"] += totals.fetch("fixable") - report.push(generate_report result) + if (totals["errors"] + totals.fetch("warnings") + totals.fetch("fixable")) > 0 + report.push(generate_report result) + end end end - markdown "# PHP_CodeSniffer report" - markdown generate_summary_markdown summary - markdown report + if (summary["errors"] + summary["warnings"] + summary["fixable"]) > 0 + markdown "# PHP_CodeSniffer report" + markdown generate_summary_markdown summary + markdown report + end + if fail_on_error && summary["errors"] > 0 fail "There are #{summary["errors"]} errors that need to be resolved." end end