Skip to main content

Flake8 plugin that forbids implicit str/bytes literal concatenations

Project description

PyPI version PyPI - Python Version Downloads Github Actions Codecov Hatch project

flake8-no-implicit-str-concat-in-list

Flake8 plugin that forbids implicit str/bytes literal concatenations inside literals such as lists, sets and tuples.

# NG
a = ["aaa",
     "bbb"
     "ccc"]

# OK
print('foobar' 'baz')
a = ["aaa",
     "bbb"
     + "ccc"]
b = b'abcdef'
s = ('abc'
    'def')

Installation

Install via pip:

pip install flake8-no-implicit-str-concat-in-list

Violation Codes

The plugin uses the prefix ICL, short for no implicit string concatenation in lists. Unfortunately flake8 only allows three characters for the error code prefix.

Code Description
ICL122 Implicitly concatenated bytes literals in list literal over multiple lines.
ICL112 Implicitly concatenated bytes literals in list literal.
ICL121 Implicitly concatenated str literals in list literal over multiple lines.
ICL111 Implicitly concatenated str literals in list literal.
ICL222 Implicitly concatenated bytes literals in tuple literal over multiple lines.
ICL212 Implicitly concatenated bytes literals in tuple literal.
ICL221 Implicitly concatenated str literals in tuple literal over multiple lines.
ICL211 Implicitly concatenated str literals in tuple literal.
ICL322 Implicitly concatenated bytes literals in set literal over multiple lines.
ICL312 Implicitly concatenated bytes literals in set literal.
ICL321 Implicitly concatenated str literals in set literal over multiple lines.
ICL311 Implicitly concatenated str literals in set literal.

Other Plugins & Linters

  • flake8-implicit-str-concat Flake8 plugin to encourage correct string literal concatenation. This plugin is different from flake8-no-implicit-str-concat-in-list because this plugin prefers implicit concatenations over explicit + operators when concatenating literals even inside lists, tuples and set literals.
  • wemake-python-styleguide Set of strict flake8 rules with several plugins as dependencies. It implements WPS326 Found implicit string concatenation, which also checks implicit string concatenations, as one of the many rules it defines.
  • pylint This linter has implicit-str-concat rule. By default it only looks for occurrences of implicit concatenations on the same line, but it has --check-str-concat-over-line-jumps=y option to enable checking of concatenations over multiple lines.
  • flake8-no-implicit-concat This linter has no_implicit_concat rule. It also looks for implicit string concatenation but in all contexts, not just in lists.

Development

Use tools like Pipenv:

pipenv run python -m pip install -e .[dev]
pipenv run make check

License

This software is released under MIT license. See LICENSE for details.

The code was derived from flake8-no-implicit-concat, which is developed by 10sr and also released under MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file flake8_no_implicit_str_concat_in_list-0.1.0.tar.gz.

File metadata

File hashes

Hashes for flake8_no_implicit_str_concat_in_list-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b6dec674f546712b9b267b84f82ac0c9696a1ef9d5aaac8c8f9e44cc1329a54e
MD5 3d312d6d1a15fe6e5fcb2554d038e731
BLAKE2b-256 2a127f78d4331e803742e008d976781c2251b4bb8b476da16a4a57500bc7d307

See more details on using hashes here.

File details

Details for the file flake8_no_implicit_str_concat_in_list-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_no_implicit_str_concat_in_list-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7772cc8d8fc424d4ad93598e6cf6e83e1db32a56904814254f6761e24c2aa643
MD5 ca2d77d950e042548fe8480406ad59be
BLAKE2b-256 359ede0f6f167223d70cdcf39f256955d823a7d9128ea4ad5d4870eda627ec6f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page