pycodestyle icon indicating copy to clipboard operation
pycodestyle copied to clipboard

Fixing false negatives with E731 lambda assignments

Open Sam-Cleveland opened this issue 3 years ago • 3 comments

fixes #1061 Changed out the current implementation of lambda assignment detection for a regex based one. As stated in #1061, there are several lambda assignment cases that are being missed. Additionally, the current detection implementation is not in the most logical place. Before, detection of lambdas was tied to searching for ':' characters. Now lambda assignment statements are all just detected by:

(?<!\.)\w+\s*(\,\s*\w+\s*)*\=(.*\,)*[\s|\(]*lambda

This implementation has more coverage and is more simple than the previous one.

Sam-Cleveland avatar Jun 22 '22 14:06 Sam-Cleveland