Python tests failed in Travis CI with the following error message:
petstore_api/api_client.py:247:22: W605 invalid escape sequence '\['
sub_kls = re.match('list\[(.*)\]', klass).group(1)
^
petstore_api/api_client.py:247:28: W605 invalid escape sequence '\]'
sub_kls = re.match('list\[(.*)\]', klass).group(1)
^
petstore_api/api_client.py:252:22: W605 invalid escape sequence '\('
sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
^
petstore_api/api_client.py:252:37: W605 invalid escape sequence '\)'
sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
^
petstore_api/models/format_test.py:297:25: W605 invalid escape sequence '\/'
if byte is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte): # noqa: E501
^
petstore_api/models/format_test.py:297:47: W605 invalid escape sequence '\/'
if byte is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte): # noqa: E501
^
petstore_api/models/format_test.py:297:67: W605 invalid escape sequence '\/'
if byte is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte): # noqa: E501
^
petstore_api/models/format_test.py:298:94: W605 invalid escape sequence '\/'
raise ValueError("Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501
^
petstore_api/models/format_test.py:298:116: W605 invalid escape sequence '\/'
raise ValueError("Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501
^
petstore_api/models/format_test.py:298:136: W605 invalid escape sequence '\/'
raise ValueError("Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501
^
petstore_api/api/fake_api.py:615:-540: W605 invalid escape sequence '\&'
"""
^
petstore_api/api/fake_api.py:615:-527: W605 invalid escape sequence '\&'
"""
^
petstore_api/api/fake_api.py:637:-555: W605 invalid escape sequence '\&'
"""
^
petstore_api/api/fake_api.py:637:-542: W605 invalid escape sequence '\&'
"""
^
make: *** [test-all] Error 1
Latest master
It was working fine before and likely there's a overnight change wth a newer version of flake8
Shall we fix it with the suggestion in https://lintlyci.github.io/Flake8Rules/rules/W605.html? e.g.
regex = r'\.png$'
cc @taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11) @tomplus (2018/10)
Sounds like a good idea to me.
or we can do the following to ignore the issue for the time being:
flake8 --ignore W605 petstore_api/
Yes, raw strings should be used here. And you are right - the latest version of flake8 check this rule (https://gitlab.com/pycqa/flake8/issues/465). I can work on it if you are busy.
I'll take a crack at this issue if there's no objections 馃槃
I'm able to get the first few out of the way - but the one in fake_api.py is quite tricky. The problem is the \& in https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/python/petstore_api/api/fake_api.py#L624
"""To test \"client\" model # noqa: E501"""
We cannot make the string raw here since it is in the comments - what do you think we should change here?
@micw523 thanks for your help on this.
The original value is To test "client" model
To avoid code injection, we escape "
What about using {{{ . }}} instead of {{ . }} so that the output will become \" instead of \&?