| 1 |
"""Credit card number printed. |
| 2 |
|
| 3 |
--- |
| 4 |
layout: post |
| 5 |
source: ??? |
| 6 |
source_url: ??? |
| 7 |
title: credit card number printed |
| 8 |
date: 2014-06-10 12:31:19 |
| 9 |
categories: writing |
| 10 |
--- |
| 11 |
|
| 12 |
Credit card number printed. |
| 13 |
|
| 14 |
""" |
| 15 |
from proselint.tools import existence_check, memoize |
| 16 |
|
| 17 |
|
| 18 |
@memoize |
| 19 |
def check(text): |
| 20 |
"""Check the text.""" |
| 21 |
err = "security.credit_card" |
| 22 |
msg = "Don't put credit card numbers in plain text." |
| 23 |
|
| 24 |
credit_card_numbers = [ |
| 25 |
r"4\d{15}", |
| 26 |
r"5[1-5]\d{14}", |
| 27 |
r"3[4,7]\d{13}", |
| 28 |
r"3[0,6,8]\d{12}", |
| 29 |
r"6011\d{12}", |
| 30 |
] |
| 31 |
|
| 32 |
return existence_check(text, credit_card_numbers, err, msg) |