PyCQA / PyCQA/pycodestyle

Prevent confusion with unintentional traling commas

Open
#691 8 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.2k
Forks
754
PR merge metrics
No merged PRs in 30d

Description

There is the common programmer mistake to leave a trailing comma on a value, that leads that value unexpectedly treated as a tuple [1] [2]

PEP8 guide already warn on this
https://www.python.org/dev/peps/pep-0008/#when-to-use-trailing-commas

Yes:

FILES = ('setup.cfg',)
OK, but confusing:

FILES = 'setup.cfg',

What you think about to allow pycodestyle tool to produce a warning message in that case?

Pylint has that check since 1.7 version

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing pycodestyle's Python implementation and its existing warning checks, then compare the requested behavior with the PEP 8 trailing-comma guidance and Pylint's related check. Define the warning's scope and message for single values written with an unintended trailing comma, and verify that existing checks remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.