Skip to main content

Flake8 plugin that forbids implicit string literal concatenations

Project description

Github Actions codecov PyPI - Python Version PyPI version Downloads Code style: black

flake8-no-implicit-concat

Flake8 plugin that forbids implicit string literal concatenations.

# NG
a = "abc" "def"
b = ["aaa",
     "bbb"
     "ccc"]
# OK
a = "abcdef"
b = ["aaa",
     "bbb" +
     "ccc"]

Installation

Install via pip:

pip install flake8-no-implicit-concat

Violation code

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

Code Description
NIC001 Implicitly concatenated string literals in one line
NIC002 Implicitly concatenated string literals over multiple lines

Other Plugins & Linters

  • flake8-implicit-str-concat Flake8 plugin to encourage correct string literal concatenation. flake8-no-implicit-concat is different from this plugin because there are cases where this plugin prefers implicit concatenations over explicit + operators.
  • 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.2.1.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

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