sourcery-ai / sourcery

Instant AI code reviews
https://sourcery.ai
MIT License
1.51k stars 65 forks source link

replace-interpolation-with-fstring for logging collides with pylint rule #306

Open piankma opened 1 year ago

piankma commented 1 year ago

Checklist

Description

For the code below for logging i'm getting a suggestion: Replace interpolated string formatting with f-string (replace-interpolation-with-fstring) After accepting the fix, pylint disagrees with that, and reports "logging-fstring-interpolation"

Is aligning with pylint planned?

Code snippet that reproduces issue

        log.info("HTTP GET call : %s header=%s param=%s" % (self.url, header, content))

Debug Information

IDE Version: unrelated

Sourcery Version: 0.13.0

Operating system and Version: unrelated

Hellebore commented 1 year ago

Thanks for raising @piankma . I think ideally we'd suggest something like the optimisations here instead: https://github.com/sourcery-ai/sourcery/issues/276

myxie commented 2 months ago

Hi all,

Just wanted to flag that this is still popping up (e.g. https://github.com/ICRAR/daliuge/pull/254#discussion_r1606403669). Is there a way to disable particular forms of Sourcery suggestions? I can imagine this tripping up those not familiar with the distinctions between f-string and %strings for logging.

Warm Regards,

Ryan