Skip to content

Ignore multi-line calls in duplicate detection (R0801) #7920

Open
@Bengt

Description

@Bengt

Current problem

When I run PyLint on my code base, which contains many multi-line function calls like this:

return_value_0,
return_value_1,
return_value_2,
return_value_3 = \
    my_function(
        parameter_0,
        parameter_1,
        parameter_2,
        parameter_3,
)

PyLint complains over duplicate code:

R0801: Similar lines in 2 files

Note that while this call spans multiple lines, it is only a single statement. Maybe single statements should never be considered duplicates, as they might just be the canonical form? Maybe --ignore-multiline-statements would be a sensible name.

Desired solution

I would like PyLint to detect these multi-line duplicates as okay, since they are the canonical way of calling these functions in my style of formatting the code.

Additional context

@Pierre-Sassoulas suggested introducing an option like --ignore-multiline-calls (like other similarities checker options https://pylint.pycqa.org/en/latest/user_guide/configuration/all-options.html#similarities-checker) here: #214 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement ✨Improvement to a componentNeeds decision 🔒Needs a decision before implemention or rejectionduplicate-codeRelated to code duplication checker

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions