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
a = 'abc' 'def'
b = ["aaa",
     "bbb"
     "ccc"]
c = b'hoge' b'fuga'

# OK
a = 'abcdef'
b = ["aaa",
     "bbb" +
     "ccc"]
c = b'hogefuga'

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.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

  • Download URL: flake8-no-implicit-concat-0.3.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 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.1.tar.gz
Algorithm Hash digest
SHA256 85b9aef1b980af72f64cd0e7db0a64067e88c46a544f31673292b53de01283a4
MD5 2d52c8f9c2e1ef417dc54675cd7f3225
BLAKE2b-256 9c0b4d9916caca2c9466a1008b5d026318bb5de6e3e9dde5141cdb5c0931daa8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flake8_no_implicit_concat-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0fd2158dbb2166d431794bc5a382faca537fca724980dac31b3895b16441c38
MD5 e5dc0d3b2ae17525e6cbeae36def5f96
BLAKE2b-256 4e11463bc828be52dac11263ec6afa7623fc970a5d3ef9202b83b9211c923199

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