Flake8 plugin that forbids implicit str/bytes literal concatenations inside literals such as lists, sets and tuples.
# NG
a = ["aaa",
"bbb"
"ccc"]
# OK
print('foobar' 'baz')
a = ["aaa",
"bbb"
+ "ccc"]
b = b'abcdef'
s = ('abc'
'def')
Install via pip:
pip install flake8-no-implicit-str-concat-in-list
The plugin uses the prefix ICL, short for no implicit string concatenation in lists.
Unfortunately flake8 only allows three characters for the error code prefix.
| Code | Description |
|---|---|
| ICL122 | Implicitly concatenated bytes literals in list literal over multiple lines. |
| ICL112 | Implicitly concatenated bytes literals in list literal. |
| ICL121 | Implicitly concatenated str literals in list literal over multiple lines. |
| ICL111 | Implicitly concatenated str literals in list literal. |
| ICL222 | Implicitly concatenated bytes literals in tuple literal over multiple lines. |
| ICL212 | Implicitly concatenated bytes literals in tuple literal. |
| ICL221 | Implicitly concatenated str literals in tuple literal over multiple lines. |
| ICL211 | Implicitly concatenated str literals in tuple literal. |
| ICL322 | Implicitly concatenated bytes literals in set literal over multiple lines. |
| ICL312 | Implicitly concatenated bytes literals in set literal. |
| ICL321 | Implicitly concatenated str literals in set literal over multiple lines. |
| ICL311 | Implicitly concatenated str literals in set literal. |
- flake8-implicit-str-concat
Flake8 plugin to encourage correct string literal concatenation.
This plugin is different from
flake8-no-implicit-str-concat-in-listbecause this plugin prefers implicit concatenations over explicit+operators when concatenating literals even inside lists, tuples and set literals. - 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-concatrule. By default it only looks for occurrences of implicit concatenations on the same line, but it has--check-str-concat-over-line-jumps=yoption to enable checking of concatenations over multiple lines. - flake8-no-implicit-concat
This linter has
no_implicit_concatrule. It also looks for implicit string concatenation but in all contexts, not just in lists.
Use tools like Pipenv:
pipenv run python -m pip install -e .[dev]
pipenv run make check
This software is released under MIT license. See LICENSE for details.
The code was derived from flake8-no-implicit-concat, which is developed by 10sr and also released under MIT license.