Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less fp's #4279

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions findspam.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,8 @@ def len_img_block(string):


# max_score=2 to prevent voting fraud
@create_rule("post is mostly images", title=False, max_rep=201, max_score=2)
@create_rule("post is mostly images", title=False, max_rep=201, max_score=2, sites=[
"math.stackexchange.com", "mathoverflow.net", "stats.stackexchange.com"])
def mostly_img(s, site):
if len(s) == 0:
return False, ""
Expand Down Expand Up @@ -1416,8 +1417,9 @@ def strip_urls_and_tags(s):
return URL_REGEX.sub("", TAG_REGEX.sub("", s))


@create_rule("mostly punctuation marks in {}", max_rep=52,
sites=["math.stackexchange.com", "mathoverflow.net", "codegolf.stackexchange.com"])
@create_rule("mostly punctuation marks in {}", max_rep=52, sites=[
"stats.stackexchange.com", "math.stackexchange.com",
"mathoverflow.net", "codegolf.stackexchange.com"])
def mostly_punctuations(s, site):
# Strip code blocks here rather than with `stripcodeblocks` so we get the length of the whole post in s.
body = regex.sub(r"(?s)<pre([\w=\" -]*)?>.*?</pre>", "", s)
Expand Down
6 changes: 3 additions & 3 deletions test/test_findspam.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
('Should not be caught: http://example.com', '', '', 'drupal.stackexchange.com', False, False, False),
('Should not be caught: https://www.example.com', '', '', 'drupal.stackexchange.com', False, False, False),
('Should not be caught: [email protected]', '', '', 'drupal.stackexchange.com', False, False, False),
('Title here', '<img src="http://example.com/11111111111.jpg" alt="my image">', '', 'stackoverflow.com', False, False, True),
('Title here', '<img src="http://example.com/11111111111111.jpg" alt="my image" />', '', 'stackoverflow.com', False, False, True),
('Title here', '<a href="http://example.com/11111111111111.html">page</a>', '', 'stackoverflow.com', False, False, False),
('Title here', '<img src="http://example.com/11111111111.jpg" alt="my image">', '', 'askubuntu.com', False, False, True),
('Title here', '<img src="http://example.com/11111111111111.jpg" alt="my image" />', '', 'askubuntu.com', False, False, True),
('Title here', '<a href="http://example.com/11111111111111.html">page</a>', '', 'askubuntu.com', False, False, False),
('Error: 2147467259', '', '', 'stackoverflow.com', False, False, False),
('Max limit on number of concurrent ajax request', """<p>Php java script boring yaaarrr <a href="http://www.price-buy.com/" rel="nofollow noreferrer">Price-Buy.com</a> </p>""", 'Price Buy', 'stackoverflow.com', True, True, True),
('Proof of onward travel in Japan?', """<p>The best solution to overcome the problem of your travel<a href="https://i.stack.imgur.com/eS6WQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eS6WQ.jpg" alt="enter image description here"></a></p>
Expand Down