On Tue, Sep 4, 2012 at 2:26 AM, Sylvain Thénault <
[email protected]> wrote:

>
> Hi Martin,
>
> On 03 septembre 13:13, Martin Pool wrote:
> > We were recently debugging some code like this:
> >
> >   re.compile('\\\\/')
> >
> > This is legal Python (equivalent to r'\\/') but possibly buggy.  It would
> > be safer and clearer to say r'\\/' if that's what you want - and the 're'
> > manual highly recommends you should use raw strings here.
> >
> > In Python (unlike C, Perl, Python REs and most unix tools) backslashes
> > followed by a non-special character in a string literal are passed
> through
> > as backslashes, which in my small survey surprised many people.
> >
> > This patch gives a warning for string constants containing a backslash
> > followed by a character with no escaped meaning.  This seems like a good
> > way to catch strings that ought to be raw strings.
>
> sounds good to me. I've created a ticket for this feature [1], and pushed
> your
> patch as a changeset so it gets into the review system. You should see it
> linked to the ticket soon, as well as on
> http://hg-lab.logilab.org/review/pylint
> (though I don't see it yet, and that doesn't seem normal so you may have to
> wait one of our sysadmins intervention).
>
> Besides a few changes (basically ChangeLog entry and link to ticket in the
> commit message), it seems fine to me in a quick read. The only point being
> message identifier: to avoid conflicts, the first two digits should
> represent
> the checker, and you've used W0123 and W0124 while a checker ('base')
> already
> use 01. See pylint/checkers/__init__ for attributed values.


Thanks, I changed them to W14xx.


> Related question:
> do you thing a dedicated checker is worth it, rather than extending the
> existing format checker?
>

I think so: I originally looked at putting it there, but they wouldn't
really share any code, so it seemed cleaner to keep them separate.


> All this discussion should be moved around the patch in the review system
> though, and you'll probably need help here so don't hesitate to ask
> questions
> here. I'm laking some time to go in deeper details right now.
>
> Regarding your patch about symbolic warning names : I've also created a
> ticket [2].
> Your patch will be linked to the ticket automatically when pushed in our
> repository
> by adding "closes #104572" somewhere in the commit message. No changeset
> yet as
> I've not been able to apply it:
>
> [syt@scorpius pylint]$ patch -p1 < ~/attachment-0001.obj
> patching file README
> patching file checkers/base.py
> patching file checkers/format.py
> Hunk #1 succeeded at 37 (offset 2 lines).
> Hunk #2 succeeded at 75 (offset 2 lines).
> patching file checkers/imports.py
> patching file checkers/misc.py
> patching file doc/FAQ.txt
> patching file doc/manual.txt
> patching file lint.py
> patching file reporters/__init__.py
> patching file reporters/guireporter.py
> patching file reporters/html.py
> patching file reporters/text.py
> patching file test/input/func_docstring.py
> patching file test/unittest_lint.py
> patching file utils.py
> patch unexpectedly ends in middle of line
> patch: **** malformed patch at line 529:
>

I think that is a glitch in hg's diff representation of my editor
subtracting a blank final newline from the file.  It's not important.

I pushed the repository to <https://bitbucket.org/sourcefrog/pylint/overview>,
branches string-backslashes and symbolic-names respectively.


-- 
Martin
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to