This would probably be a good place for the ternary operator... I think it would be easier to read as

    @total_violations = total ? total[1].to_i : 0

alternatively

    if @output =~ (/Total Violations: (\d+)/)
      @total_violations = $1.to_i
    else
      @total_violations = 0
    end