Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orsinium-labs/flake8-comments
Report redundant comments in python code
https://github.com/orsinium-labs/flake8-comments
clean-code code-quality comments flake8 flake8-extension flake8-extensions flake8-plugin flake8-plugins linter python qa
Last synced: 3 months ago
JSON representation
Report redundant comments in python code
- Host: GitHub
- URL: https://github.com/orsinium-labs/flake8-comments
- Owner: orsinium-labs
- License: mit
- Created: 2021-06-03T06:10:31.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-06-08T12:47:45.000Z (over 3 years ago)
- Last Synced: 2024-07-01T03:45:25.322Z (4 months ago)
- Topics: clean-code, code-quality, comments, flake8, flake8-extension, flake8-extensions, flake8-plugin, flake8-plugins, linter, python, qa
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 8
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-flake8-extensions - flake8-comments - Reports redundant comments. (Comments)
README
# flake8-comments
Report redundant comments in python code.
An example of a bad comment:
```python
# create user
user.create(force=True)
```In this example, the comment gives even less information that the code itself. So, you can safely remove the comment without losing any information. The goal is to reduce the [information redundancy](https://en.wikipedia.org/wiki/Redundancy_(information_theory)), leaving in the code only what is actually important and helpful.
## Installation
```bash
python3 -m pip install flake8-comments
```## Usage
Check that plugin was added in your flake8:
```bash
$ python3 -m flake8 --version
3.7.7 (flake8-comments: 0.1.0, mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.6.7 on Linux
```If you don't see `flake8-comments` in the previous command output, check that `flake8` and `flake8-comments` is installed in the same interpreter.
If everything is OK, run `flake8`:
```bash
python -m flake8 example.py
```## Similar projects
There are a few more good flake8 plugins targeted on cleaning up comments:
+ [flake8-eradicate](https://github.com/wemake-services/flake8-eradicate) detects commented out code.
+ [flake8-todos](https://github.com/orsinium-labs/flake8-todos) controls consistency of TODO comments.
+ [wemake-python-styleguide](https://github.com/wemake-services/wemake-python-styleguide) has a few checks targeted on comments, like if there are empty comments, too many `noqa`, `no cover`, bad shebangs.