Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 29345242: Noissue - Adapt quotes for compliance with our coding style in sitescripts (Closed)

Created:
May 29, 2016, 1:26 p.m. by Sebastian Noack
Modified:
May 30, 2016, 12:36 p.m.
Reviewers:
Vasily Kuznetsov
Visibility:
Public.

Description

Noissue - Adapt quotes for compliance with our coding style in sitescripts

Patch Set 1 #

Patch Set 2 : Fixed raw string #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+1529 lines, -1532 lines) Patch
M multiplexer.py View 1 chunk +3 lines, -3 lines 0 comments Download
M sitescripts/__init__.py View 1 chunk +1 line, -1 line 0 comments Download
M sitescripts/content_blocker_lists/bin/generate_lists.py View 2 chunks +24 lines, -24 lines 0 comments Download
M sitescripts/crawler/bin/import_sites.py View 3 chunks +12 lines, -12 lines 0 comments Download
M sitescripts/crawler/web/crawler.py View 7 chunks +30 lines, -30 lines 0 comments Download
M sitescripts/docs/bin/generate_docs.py View 5 chunks +18 lines, -18 lines 0 comments Download
M sitescripts/extensions/bin/createNightlies.py View 13 chunks +21 lines, -21 lines 0 comments Download
M sitescripts/extensions/bin/updateUpdateManifests.py View 3 chunks +4 lines, -4 lines 0 comments Download
M sitescripts/extensions/utils.py View 6 chunks +16 lines, -16 lines 0 comments Download
M sitescripts/extensions/web/adblockbrowserUpdates.py View 4 chunks +34 lines, -34 lines 0 comments Download
M sitescripts/extensions/web/downloads.py View 2 chunks +2 lines, -2 lines 0 comments Download
M sitescripts/management/bin/generateNotifications.py View 1 chunk +6 lines, -6 lines 0 comments Download
M sitescripts/management/bin/start_services.py View 3 chunks +7 lines, -7 lines 0 comments Download
M sitescripts/notifications/parser.py View 2 chunks +51 lines, -51 lines 0 comments Download
M sitescripts/notifications/test/notification.py View 3 chunks +174 lines, -174 lines 0 comments Download
M sitescripts/notifications/test/parser.py View 2 chunks +34 lines, -34 lines 0 comments Download
M sitescripts/notifications/web/notification.py View 3 chunks +30 lines, -30 lines 0 comments Download
M sitescripts/reports/web/showDigest.py View 1 chunk +1 line, -1 line 0 comments Download
M sitescripts/send_installation_link/web/send_installation_link.py View 1 chunk +7 lines, -7 lines 0 comments Download
M sitescripts/stats/bin/logprocessor.py View 14 chunks +185 lines, -185 lines 0 comments Download
M sitescripts/stats/bin/pagegenerator.py View 4 chunks +59 lines, -59 lines 0 comments Download
M sitescripts/stats/common.py View 2 chunks +77 lines, -77 lines 0 comments Download
M sitescripts/stats/countrycodes.py View 1 chunk +1 line, -1 line 0 comments Download
M sitescripts/stats/test/common.py View 1 chunk +8 lines, -8 lines 0 comments Download
M sitescripts/stats/test/logprocessor.py View 12 chunks +482 lines, -482 lines 0 comments Download
M sitescripts/subscriptions/bin/updateSubscriptionDownloads.py View 1 chunk +12 lines, -12 lines 0 comments Download
M sitescripts/subscriptions/combineSubscriptions.py View 10 chunks +84 lines, -84 lines 0 comments Download
M sitescripts/subscriptions/subscriptionParser.py View 3 chunks +25 lines, -25 lines 0 comments Download
M sitescripts/testpages/web/sitekey_frame.py View 1 chunk +10 lines, -10 lines 0 comments Download
M sitescripts/urlfixer/bin/forceDomains.py View 1 chunk +11 lines, -11 lines 0 comments Download
M sitescripts/urlfixer/bin/topDomains.py View 1 3 chunks +20 lines, -20 lines 3 comments Download
M sitescripts/urlfixer/web/submitData.py View 3 chunks +24 lines, -24 lines 0 comments Download
M sitescripts/utils.py View 3 chunks +4 lines, -4 lines 0 comments Download
M sitescripts/web.py View 3 chunks +21 lines, -21 lines 0 comments Download
M tox.ini View 2 chunks +31 lines, -34 lines 0 comments Download

Messages

Total messages: 4
Sebastian Noack
All changes except for tox.ini have been performed automatically by this script: https://gist.github.com/snoack/ca864fbab537782e574508e0368de033 I verified ...
May 29, 2016, 1:29 p.m. (2016-05-29 13:29:39 UTC) #1
Vasily Kuznetsov
https://codereview.adblockplus.org/29345242/diff/29345301/sitescripts/urlfixer/bin/topDomains.py File sitescripts/urlfixer/bin/topDomains.py (right): https://codereview.adblockplus.org/29345242/diff/29345301/sitescripts/urlfixer/bin/topDomains.py#newcode45 sitescripts/urlfixer/bin/topDomains.py:45: if re.search(r"['\"_,<>:;!$%&/()*+#~]|^\.|\.$|\.\.", domain): I now get A110 on this ...
May 30, 2016, 10:01 a.m. (2016-05-30 10:01:42 UTC) #2
Sebastian Noack
https://codereview.adblockplus.org/29345242/diff/29345301/sitescripts/urlfixer/bin/topDomains.py File sitescripts/urlfixer/bin/topDomains.py (right): https://codereview.adblockplus.org/29345242/diff/29345301/sitescripts/urlfixer/bin/topDomains.py#newcode45 sitescripts/urlfixer/bin/topDomains.py:45: if re.search(r"['\"_,<>:;!$%&/()*+#~]|^\.|\.$|\.\.", domain): On 2016/05/30 10:01:41, Vasily Kuznetsov wrote: ...
May 30, 2016, 10:27 a.m. (2016-05-30 10:27:18 UTC) #3
Vasily Kuznetsov
May 30, 2016, 12:16 p.m. (2016-05-30 12:16:34 UTC) #4
LGTM

https://codereview.adblockplus.org/29345242/diff/29345301/sitescripts/urlfixe...
File sitescripts/urlfixer/bin/topDomains.py (right):

https://codereview.adblockplus.org/29345242/diff/29345301/sitescripts/urlfixe...
sitescripts/urlfixer/bin/topDomains.py:45: if
re.search(r"['\"_,<>:;!$%&/()*+#~]|^\.|\.$|\.\.", domain):
On 2016/05/30 10:27:18, Sebastian Noack wrote:
> On 2016/05/30 10:01:41, Vasily Kuznetsov wrote:
> > I now get A110 on this line. It seems that converting the regex to single
> quotes
> > is not really possible without changing it or dropping r and getting
something
> > like the ugly automatic conversion that you replaced.
> > 
> > So it seems we have several options:
> > 1. Leave it as is and add a # noqa to the line or include it into the
config,
> > 2. Revert to more ugly machine-translated version,
> > 3. Change it to r'[\'"_,<>:;!$%&/()*+#~]|^\.|\.$|\.\.'
> > 
> > The third one will change the bytecode but it won't change the meaning of
the
> > regex because backslash-escaped quotes in regexes are the same as unescaped
> > quotes (most likely the original regex escaped the double quote just to
> include
> > it in a double-quote-delimited string).
> > 
> > The third option seems to be the most "right" one but it's also the most
scary
> > since we won't have the assurance of bytecode not changing.
> > 
> > What do you think?
> 
> Well, there is also the fourth option to fix flake8-abp which I went for:
> https://codereview.adblockplus.org/29345337/
> 
> Though, generally, I'd agree that this string should have been written as
> r'[\'"_,<>:;!$%&/()*+#~]|^\.|\.$|\.\.' which while not the same string anymore
> should theoretically behave exactly the same when used as regular expression.
> But we still would have to retest the code.
> 
> Moreover, when using raw strings for something other than regular expressions,
> moving backslashes around might not even be an option. So we have to relax
> flake8-abp anyway.

I agree that moving the backslashes around is not always possible, so fixing
flake8-abp seems like the best solution.

Powered by Google App Engine
This is Rietveld