Skip to main content

Flake8 plugin that forbids implicit str/bytes literal concatenations

Project description

PyPI version PyPI - Python Version Downloads Github Actions Codecov

flake8-no-implicit-concat

Flake8 plugin that forbids implicit str/bytes literal concatenations.

# NG
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 licensed under MIT license. See LICENSE for details.

The code was derived from flake8-implicit-str-concat, which is developed by Dylan Turner and also licensed 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.2.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file flake8-no-implicit-concat-0.3.2.tar.gz.

File metadata

  • Download URL: flake8-no-implicit-concat-0.3.2.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for flake8-no-implicit-concat-0.3.2.tar.gz
Algorithm Hash digest
SHA256 ba7f156b5f0e452b8641ec83075bf749e6d18d84dbb5b7a7466f7825c71270c4
MD5 3b91e6de3521554a612e954e6d8414e1
BLAKE2b-256 d3b4827091a41334abc5b78a77e2b17e03a9c11e4b2fc4775569b57a4b0c3976

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flake8_no_implicit_concat-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for flake8_no_implicit_concat-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 993b9b6d41a361dd4363f17375f6e645fb1e11568fc16e05cc7b3e7671745f64
MD5 9485d05116890c3e006c0c6a2a57e579
BLAKE2b-256 74485d219968e1c09cf2b2092aac4ba91e59a6d80cd87ebc14dfcbee4298dccc

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