Skip to main content

Flake8 plugin that forbids implicit str/bytes literal concatenations

Project description

PyPI version PyPI - Python Version Downloads build Codecov

flake8-no-implicit-concat

Flake8 plugin that forbids implicit str/bytes literal concatenations.

# Not Allowed
print('foo' 'bar', 'baz')
a = ["aaa",
     "bbb"
     "ccc"]
b = b'abc' b'def'

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

Installation

Install via pip:

pip install flake8-no-implicit-concat

Violation Codes

The plugin uses the prefix NIC, short for No Implicit Concatenation.

Code Description
NIC001 Implicitly concatenated str literals on one line
NIC002 Implicitly concatenated str literals over multiple lines
NIC101 Implicitly concatenated bytes literals on one line
NIC102 Implicitly concatenated bytes literals over multiple lines

Other Plugins & Linters

  • flake8-implicit-str-concat Flake8 plugin to encourage correct string literal concatenation. This plugin is different from flake8-no-implicit-concat because this plugin prefers implicit concatenations over explicit + operators when concatenating literals over multiple lines.
  • 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.

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-implicit-str-concat, which is developed by Dylan Turner 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

flake8_no_implicit_concat-0.3.6.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file flake8_no_implicit_concat-0.3.6.tar.gz.

File metadata

File hashes

Hashes for flake8_no_implicit_concat-0.3.6.tar.gz
Algorithm Hash digest
SHA256 41519e710ba725ce1749e0da46cb5b27d9ed407d1da4e48357f60178e8387462
MD5 880cafc5f3544ce233f69f48d3b6ce31
BLAKE2b-256 73391b0f0775a7076bc3dc382f2bab4d4064202a03173df71e2046346b179f39

See more details on using hashes here.

File details

Details for the file flake8_no_implicit_concat-0.3.6-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_no_implicit_concat-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b7c180b51c8f69046328c4a74d1ce7a83816e63f9e2cff4d12a707f94eb8c130
MD5 2ced88ed3ee19f63d48094c3e2a54fd0
BLAKE2b-256 08f458a4420b311be353767935de69f8fddf35503f10b697be5c6d693ab9c0c1

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