Skip to content

10sr/flake8-no-implicit-concat

Folders and files

NameName
Last commit message
Last commit date
Nov 26, 2024
Nov 4, 2024
Oct 5, 2024
Oct 7, 2021
Jan 13, 2022
Nov 4, 2024
Nov 5, 2024
Aug 27, 2020
Oct 7, 2021
Nov 7, 2024
Nov 8, 2024
Nov 4, 2024
Nov 11, 2024
Nov 4, 2024

Repository files navigation

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 .[test,lint]
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.