You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a new check to flake8-bugbear, and it would be great to have it incorporated into ruff as well. Copying from the issue PyCQA/flake8-bugbear#397
$ re.sub('a', 'b', 'aaa')
'bbb'
$ re.sub('a', 'b', 'aaa', re.IGNORECASE)
'bba'>>>re.split(' ', 'a a a a')
['a', 'a', 'a', 'a']
>>>re.split(' ', 'a a a a', re.I)
['a', 'a', 'a a']
>>>re.split(' ', 'a a a a', flags=re.I)
['a', 'a', 'a', 'a']
The fourth parameter to re.sub[n] is in fact count, and the third to split is maxsplit, and as seen in the above linked issues this is a very common mistake.
I added a new check to flake8-bugbear, and it would be great to have it incorporated into ruff as well. Copying from the issue PyCQA/flake8-bugbear#397
Context
Example code
The fourth parameter to
re.sub[n]
is in factcount
, and the third tosplit
ismaxsplit
, and as seen in the above linked issues this is a very common mistake.Links
See the issue PyCQA/flake8-bugbear#397 for discussion around implementation, and PyCQA/flake8-bugbear#398 for the PR I wrote implementing it.
The text was updated successfully, but these errors were encountered: