flake8-no-implicit-concat is a Flake8 plugin designed to forbid implicit string and bytes literal concatenations in Python code. It helps enforce a coding style where string concatenation is always explicit, thereby preventing subtle bugs caused by accidentally concatenated literals. The current version is 0.3.7, and the project maintains an active release cadence with regular updates.
pip install flake8-no-implicit-concatNo compatibility data collected yet for this library.
After installation, `flake8-no-implicit-concat` is automatically registered with Flake8. Simply run `flake8` on your project to start detecting implicit string/bytes literal concatenations. The plugin uses error codes prefixed with 'NIC' (No Implicit Concatenation).
Ensure all string concatenations are explicit (e.g., using `+` or `.join()`) or that separate string literals in collections are properly delimited by commas.
Add `--check-str-concat-over-line-jumps=y` to your Flake8 command or configuration file (e.g., `setup.cfg`, `pyproject.toml`) to enforce checking across line jumps.
Review your project's coding style guide and select the appropriate plugin. If you want to strictly forbid all implicit concatenations, `flake8-no-implicit-concat` is the correct choice.
Explicitly concatenate the string literals using the `+` operator, or separate them with a comma if they are elements in a collection. For example, change `'foo' 'bar'` to `'foo' + 'bar'` or `['foo', 'bar']`.
Ensure `flake8-no-implicit-concat` is installed in the same environment as Flake8 (e.g., `pip install flake8 flake8-no-implicit-concat`). If it's still not working, check your Flake8 configuration files (`.flake8`, `setup.cfg`, or `pyproject.toml`) to ensure no conflicting settings are present or that the plugin isn't explicitly disabled.
To ignore globally, add `ignore = NIC001` to your Flake8 configuration file (e.g., in `setup.cfg` under `[flake8]`). To ignore for a specific line, add `# noqa: NIC001` at the end of the line. To ignore for a specific file, add `# flake8: noqa` at the top of the file.