pylint icon indicating copy to clipboard operation
pylint copied to clipboard

[duplicate-code] unclear how to disable the message for select occurrences, while keeping the option enabled in general

Open Pierre-Sassoulas opened this issue 1 year ago • 0 comments

I’m a little unclear on how to disable the message for select occurrences, while keeping the option enabled in general. The docs don’t mention that detail either.

For example, suppose I have

************* Module foo.bar
path/to/foo/bar.py:1:0: R0801: Similar lines in 2 files
==foo.other.nip:[32:89]
==foo.bar:[37:97]

    a = b
    b = more()
    some_other_code()  (duplicate-code)

Adding a # pylint: disable=duplicate-code to lines 32 and 37 in both files, respectively, doesn’t work. How can I then silence the warning?

Originally posted by @jenstroeger in https://github.com/pylint-dev/pylint/issues/214#issuecomment-1920536103

Pierre-Sassoulas avatar Feb 01 '24 14:02 Pierre-Sassoulas