Skip to content

False negative trailing-comma-tuple #8201

Open
@mattclay

Description

@mattclay

Bug description

A false negative with the trailing-comma-tuple rule can occur due to code preceding the use of a comma.

"""detected.py"""
# pylint: disable=expression-not-assigned

print("demo"),
"""undetected.py"""
# pylint: disable=expression-not-assigned

DEMO = True

print("demo"),

Configuration

No response

Command used

pylint detected.py undetected.py

Pylint output

************* Module detected
detected.py:4:0: R1707: Disallow trailing comma tuple (trailing-comma-tuple)

Expected behavior

************* Module detected
detected.py:4:0: R1707: Disallow trailing comma tuple (trailing-comma-tuple)
************* Module undetected
undetected.py:6:0: R1707: Disallow trailing comma tuple (trailing-comma-tuple)

Pylint version

pylint 2.16.1
astroid 2.14.1
Python 3.11.1 (main, Jan 28 2023, 18:47:50) [GCC 11.3.0]

OS / Environment

Ubuntu 22.04.1

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Negative 🦋No message is emitted but something is wrong with the codeHelp wanted 🙏Outside help would be appreciated, good for new contributorsHigh effort 🏋Difficult solution or problem to solveNeeds design proposal 🔒This is a huge feature, some discussion should happen before a PR is proposed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions