lib/packwerk/parse_run.rb in packwerk-1.2.0 vs lib/packwerk/parse_run.rb in packwerk-1.3.0
- old
+ new
@@ -22,15 +22,11 @@
def detect_stale_violations
offense_collection = find_offenses
result_status = !offense_collection.stale_violations?
- message = if result_status
- "No stale violations detected"
- else
- "There were stale violations found, please run `packwerk update-deprecations`"
- end
+ message = @offenses_formatter.show_stale_violations(offense_collection)
Result.new(message: message, status: result_status)
end
def update_deprecations
@@ -45,11 +41,17 @@
Result.new(message: message, status: offense_collection.errors.empty?)
end
def check
offense_collection = find_offenses(show_errors: true)
- message = @offenses_formatter.show_offenses(offense_collection.outstanding_offenses)
- Result.new(message: message, status: offense_collection.outstanding_offenses.empty?)
+
+ messages = [
+ @offenses_formatter.show_offenses(offense_collection.outstanding_offenses),
+ @offenses_formatter.show_stale_violations(offense_collection),
+ ]
+ result_status = offense_collection.outstanding_offenses.empty? && !offense_collection.stale_violations?
+
+ Result.new(message: messages.join("\n") + "\n", status: result_status)
end
private
def find_offenses(show_errors: false)