Flake8 Extension to enforce better comma placement.
===================================================
.. image:: https://unmaintained.tech/badge.svg
:target: https://unmaintained.tech
:alt: No Maintenance Intended
**Note:** `Black <https://pypi.org/project/black/>`_, the uncompromising Python code
formatter, or `add-trailing-comma <https://github.com/asottile/add-trailing-comma>`_
can do all this comma insertion automatically. We recommend you use one of those tools
instead.
Usage
-----
If you are using flake8 it's as easy as:
.. code:: shell
pip install flake8-commas
Now you can avoid those annoying merge conflicts on dictionary and list diffs.
Errors
------
Different versions of python require commas in different places. Ignore the
errors for languages you don't use in your flake8 config:
+------+-----------------------------------------+
| Code | message |
+======+=========================================+
| C812 | missing trailing comma |
+------+-----------------------------------------+
| C813 | missing trailing comma in Python 3 |
+------+-----------------------------------------+
| C814 | missing trailing comma in Python 2 |
+------+-----------------------------------------+
| C815 | missing trailing comma in Python 3.5+ |
+------+-----------------------------------------+
| C816 | missing trailing comma in Python 3.6+ |
+------+-----------------------------------------+
| C818 | trailing comma on bare tuple prohibited |
+------+-----------------------------------------+
| C819 | trailing comma prohibited |
+------+-----------------------------------------+
Examples
--------
.. code:: Python
lookup_table = {
'key1': 'value',
'key2': 'something' # <-- missing a trailing comma
}
json_data = json.dumps({
"key": "value",
}), # <-- incorrect trailing comma. json_data is now a tuple. Likely by accident.
2.1.0 (2021-10-13)
------------------
- Remove upper bound on flake8.
(`Issue #67 <https://github.com/PyCQA/flake8-commas/issues/67>`_)
- Note: this project is no longer maintained, and now black
or https://github.com/asottile/add-trailing-comma is recommended instead.
(`Issue #63 <https://github.com/PyCQA/flake8-commas/pull/63>`_)
(`Issue #69 <https://github.com/PyCQA/flake8-commas/pull/69>`_)
2.0.0 (2018-03-19)
------------------
- Hide ._base from flake8 --version.
(`Issue #45 <https://github.com/PyCQA/flake8-commas/issue/45>`_)
- Update URL to https://github.com/PyCQA/flake8-commas/.
(`Issue #51 <https://github.com/PyCQA/flake8-commas/pull/51>`_)
- Add check for trailing commas on bare tuples - C818, thanks to
`Chris AtLee <https://github.com/catlee>`_ and
`Arkadiusz Adamski <https://github.com/ar4s/flake8_tuple>`_
(`PR #52 <https://github.com/PyCQA/flake8-commas/pull/52>`_)
1.0.0 (2018-01-04)
------------------
- No changes from 0.5.1, just releasing the first major version.
0.5.1 (2018-01-02)
------------------
- Refactor single/multi tuple/subscript to simply count commas in all cases.
- Prohibit trailing commas in lambda parameter lists.
- Fix a missing trailing comma false positive in subcripts with slices.
- Fix a prohibited trailing comma false positve in subscripts with slices.
- All (`Issue #48 <https://github.com/flake8-commas/flake8-commas/pull/48>`_)
0.5.0 (2018-01-02)
------------------
- Remove EOL Python 3.3.
(`Issue #47 <https://github.com/flake8-commas/flake8-commas/pull/47>`_)
- Prohibit trailing commas where there is no following new line
(or forming a single element tuple).
(`Issue #46 <https://github.com/flake8-commas/flake8-commas/pull/46>`_)
0.4.3 (2017-04-25)
------------------
- Enforce trailing commas in subscript tuples and slices again.
Regression from 0.4.2
(`Issue #42 <https://github.com/flake8-commas/flake8-commas/pull/42>`_)
0.4.2 (2017-04-18)
------------------
- Prevent lambda params in a parenth form enforcing a trailing comma.
(`Issue #41 <https://github.com/flake8-commas/flake8-commas/pull/41>`_)
- Fix issue preventing execution on Python 2 with Flake8 3.
(`Issue #35 <https://github.com/flake8-commas/flake8-commas/issues/35>`_)
- Allow bare wrapped subscript notation access.
(`Issue #39 <https://github.com/flake8-commas/flake8-commas/pull/39>`_)
- Don't require comma in assert statement with parenth form.
(`Issue #37 <https://github.com/flake8-commas/flake8-commas/pull/37>`_)
0.4.1 (2017-01-18)
------------------
- Add the framework flake8 trove classifier.
0.4.0 (2017-01-18)
------------------
- Support flake8 3.x.x.
(`Issue #20 <https://github.com/flake8-commas/flake8-commas/issue/20>`_)
- No trailing comma after any function def with unpack.
- support Python 3.6 `issue9232 <https://bugs.python.org/issue9232>`_
trailing commas.
(`Issue #33 <https://github.com/flake8-commas/flake8-commas/pull/33>`_)
0.3.1 (2017-01-18)
------------------
- Also parse unpacks with literals.
(`Issue #30 <https://github.com/flake8-commas/flake8-commas/issue/30>`_)
0.3.0 (2017-01-16)
------------------
- If there is a comment after the last item, do not report an error.
(`Issue #18 <https://github.com/flake8-commas/flake8-commas/issue/18>`_)
- If there is an empty, tuple, list, dict, or function, do not report an error.
(`Issue #17 <https://github.com/flake8-commas/flake8-commas/issue/17>`_)
- Support PEP 3132 Python 3.5+ extended unpacking.
(`Issue #26 <https://github.com/flake8-commas/flake8-commas/issue/26>`_)
- `*args` should not require a trailing comma.
(`Issue #27 <https://github.com/flake8-commas/flake8-commas/issue/27>`_)
0.2.0 (2017-01-13)
------------------
- First version of flake8-commas with changelog
- Fix HTML readme render on PyPI.
- Support various parenth_form edge cases.
- Merge from flake8-trailing-commas
Raw data
{
"_id": null,
"home_page": "https://github.com/PyCQA/flake8-commas/",
"name": "flake8-commas",
"maintainer": "Thomas Grainger",
"docs_url": null,
"requires_python": "",
"maintainer_email": "flake8-commas@graingert.co.uk",
"keywords": "",
"author": "Trevor Creech",
"author_email": "trevor@trevorcreech.com",
"download_url": "https://files.pythonhosted.org/packages/0e/83/814bc8eb02b8883bc004384a1fb8b1f45b4a0b892e579fec7c80a9368526/flake8-commas-2.1.0.tar.gz",
"platform": "",
"description": "Flake8 Extension to enforce better comma placement.\n===================================================\n\n.. image:: https://unmaintained.tech/badge.svg\n :target: https://unmaintained.tech\n :alt: No Maintenance Intended\n\n\n**Note:** `Black <https://pypi.org/project/black/>`_, the uncompromising Python code\nformatter, or `add-trailing-comma <https://github.com/asottile/add-trailing-comma>`_\ncan do all this comma insertion automatically. We recommend you use one of those tools\ninstead.\n\nUsage\n-----\n\nIf you are using flake8 it's as easy as:\n\n.. code:: shell\n\n pip install flake8-commas\n\nNow you can avoid those annoying merge conflicts on dictionary and list diffs.\n\nErrors\n------\n\nDifferent versions of python require commas in different places. Ignore the\nerrors for languages you don't use in your flake8 config:\n\n+------+-----------------------------------------+\n| Code | message |\n+======+=========================================+\n| C812 | missing trailing comma |\n+------+-----------------------------------------+\n| C813 | missing trailing comma in Python 3 |\n+------+-----------------------------------------+\n| C814 | missing trailing comma in Python 2 |\n+------+-----------------------------------------+\n| C815 | missing trailing comma in Python 3.5+ |\n+------+-----------------------------------------+\n| C816 | missing trailing comma in Python 3.6+ |\n+------+-----------------------------------------+\n| C818 | trailing comma on bare tuple prohibited |\n+------+-----------------------------------------+\n| C819 | trailing comma prohibited |\n+------+-----------------------------------------+\n\nExamples\n--------\n\n.. code:: Python\n\n lookup_table = {\n 'key1': 'value',\n 'key2': 'something' # <-- missing a trailing comma\n }\n\n json_data = json.dumps({\n \"key\": \"value\",\n }), # <-- incorrect trailing comma. json_data is now a tuple. Likely by accident.\n\n\n\n2.1.0 (2021-10-13)\n------------------\n\n- Remove upper bound on flake8.\n (`Issue #67 <https://github.com/PyCQA/flake8-commas/issues/67>`_)\n- Note: this project is no longer maintained, and now black\n or https://github.com/asottile/add-trailing-comma is recommended instead.\n (`Issue #63 <https://github.com/PyCQA/flake8-commas/pull/63>`_)\n (`Issue #69 <https://github.com/PyCQA/flake8-commas/pull/69>`_)\n\n2.0.0 (2018-03-19)\n------------------\n\n- Hide ._base from flake8 --version.\n (`Issue #45 <https://github.com/PyCQA/flake8-commas/issue/45>`_)\n- Update URL to https://github.com/PyCQA/flake8-commas/.\n (`Issue #51 <https://github.com/PyCQA/flake8-commas/pull/51>`_)\n- Add check for trailing commas on bare tuples - C818, thanks to\n `Chris AtLee <https://github.com/catlee>`_ and\n `Arkadiusz Adamski <https://github.com/ar4s/flake8_tuple>`_\n (`PR #52 <https://github.com/PyCQA/flake8-commas/pull/52>`_)\n\n\n1.0.0 (2018-01-04)\n------------------\n\n- No changes from 0.5.1, just releasing the first major version.\n\n\n0.5.1 (2018-01-02)\n------------------\n\n- Refactor single/multi tuple/subscript to simply count commas in all cases.\n- Prohibit trailing commas in lambda parameter lists.\n- Fix a missing trailing comma false positive in subcripts with slices.\n- Fix a prohibited trailing comma false positve in subscripts with slices.\n- All (`Issue #48 <https://github.com/flake8-commas/flake8-commas/pull/48>`_)\n\n\n0.5.0 (2018-01-02)\n------------------\n\n- Remove EOL Python 3.3.\n (`Issue #47 <https://github.com/flake8-commas/flake8-commas/pull/47>`_)\n- Prohibit trailing commas where there is no following new line\n (or forming a single element tuple).\n (`Issue #46 <https://github.com/flake8-commas/flake8-commas/pull/46>`_)\n\n\n0.4.3 (2017-04-25)\n------------------\n\n- Enforce trailing commas in subscript tuples and slices again.\n Regression from 0.4.2\n (`Issue #42 <https://github.com/flake8-commas/flake8-commas/pull/42>`_)\n\n\n0.4.2 (2017-04-18)\n------------------\n\n- Prevent lambda params in a parenth form enforcing a trailing comma.\n (`Issue #41 <https://github.com/flake8-commas/flake8-commas/pull/41>`_)\n- Fix issue preventing execution on Python 2 with Flake8 3.\n (`Issue #35 <https://github.com/flake8-commas/flake8-commas/issues/35>`_)\n- Allow bare wrapped subscript notation access.\n (`Issue #39 <https://github.com/flake8-commas/flake8-commas/pull/39>`_)\n- Don't require comma in assert statement with parenth form.\n (`Issue #37 <https://github.com/flake8-commas/flake8-commas/pull/37>`_)\n\n\n0.4.1 (2017-01-18)\n------------------\n\n- Add the framework flake8 trove classifier.\n\n\n0.4.0 (2017-01-18)\n------------------\n\n- Support flake8 3.x.x.\n (`Issue #20 <https://github.com/flake8-commas/flake8-commas/issue/20>`_)\n- No trailing comma after any function def with unpack.\n- support Python 3.6 `issue9232 <https://bugs.python.org/issue9232>`_\n trailing commas.\n (`Issue #33 <https://github.com/flake8-commas/flake8-commas/pull/33>`_)\n\n\n0.3.1 (2017-01-18)\n------------------\n\n- Also parse unpacks with literals.\n (`Issue #30 <https://github.com/flake8-commas/flake8-commas/issue/30>`_)\n\n\n0.3.0 (2017-01-16)\n------------------\n\n- If there is a comment after the last item, do not report an error.\n (`Issue #18 <https://github.com/flake8-commas/flake8-commas/issue/18>`_)\n- If there is an empty, tuple, list, dict, or function, do not report an error.\n (`Issue #17 <https://github.com/flake8-commas/flake8-commas/issue/17>`_)\n- Support PEP 3132 Python 3.5+ extended unpacking.\n (`Issue #26 <https://github.com/flake8-commas/flake8-commas/issue/26>`_)\n- `*args` should not require a trailing comma.\n (`Issue #27 <https://github.com/flake8-commas/flake8-commas/issue/27>`_)\n\n\n0.2.0 (2017-01-13)\n------------------\n\n- First version of flake8-commas with changelog\n- Fix HTML readme render on PyPI.\n- Support various parenth_form edge cases.\n- Merge from flake8-trailing-commas\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Flake8 lint for trailing commas.",
"version": "2.1.0",
"project_urls": {
"Homepage": "https://github.com/PyCQA/flake8-commas/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "180d41895badcdbbe84893b95c114d5bd4345d69c9d5645a42857f1ccb84d556",
"md5": "4eea08b6a05f13e26030e95663277fae",
"sha256": "ebb96c31e01d0ef1d0685a21f3f0e2f8153a0381430e748bf0bbbb5d5b453d54"
},
"downloads": -1,
"filename": "flake8_commas-2.1.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "4eea08b6a05f13e26030e95663277fae",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 7591,
"upload_time": "2021-10-13T19:25:39",
"upload_time_iso_8601": "2021-10-13T19:25:39.472868Z",
"url": "https://files.pythonhosted.org/packages/18/0d/41895badcdbbe84893b95c114d5bd4345d69c9d5645a42857f1ccb84d556/flake8_commas-2.1.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0e83814bc8eb02b8883bc004384a1fb8b1f45b4a0b892e579fec7c80a9368526",
"md5": "96d1e2f014e4138402e15c5bceb206a2",
"sha256": "940441ab8ee544df564ae3b3f49f20462d75d5c7cac2463e0b27436e2050f263"
},
"downloads": -1,
"filename": "flake8-commas-2.1.0.tar.gz",
"has_sig": false,
"md5_digest": "96d1e2f014e4138402e15c5bceb206a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8484,
"upload_time": "2021-10-13T19:25:41",
"upload_time_iso_8601": "2021-10-13T19:25:41.600881Z",
"url": "https://files.pythonhosted.org/packages/0e/83/814bc8eb02b8883bc004384a1fb8b1f45b4a0b892e579fec7c80a9368526/flake8-commas-2.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-10-13 19:25:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PyCQA",
"github_project": "flake8-commas",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "flake8-commas"
}