From 13d2bd200911850dacde31665235122d85290265 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 19 Aug 2017 10:19:59 -0700 Subject: Add W605 warning for invalid escape sequences in string literals Starting with Python 3.6, invalid escape sequences in string literals are now deprecated. In a future version of Python, invalid escape sequences will be a syntax error. While this deprecation produces a runtime warning, it only appears if warnings are enabled and the first time the Python source is compiled to byte code. By adding a check to pycodestyle, projects can take advantage of static analysis to catch and fix these future syntax errors. For more information on the deprecation, see the Python release notes, https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior > A backslash-character pair that is not a valid escape sequence now > generates a DeprecationWarning. Although this will eventually become a > SyntaxError, that will not be for several Python releases. Fixes #633 --- docs/intro.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs') diff --git a/docs/intro.rst b/docs/intro.rst index fcdcf72..3035a2f 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -413,6 +413,8 @@ This is the current list of error and warning codes: +------------+----------------------------------------------------------------------+ | W604 | backticks are deprecated, use 'repr()' | +------------+----------------------------------------------------------------------+ +| W605 | invalid escape sequence '\x' | ++------------+----------------------------------------------------------------------+ **(*)** In the default configuration, the checks **E121**, **E123**, **E126**, -- cgit v1.2.1