Newer
Older
## Objective
Run [Flake8](https://flake8.pycqa.org/en/latest/) on your Python code to ensure it adheres to PEP8
standards and to detect various errors such as syntax errors, semantic errors, and complex code.
Flake8 is a Python tool that glues together pycodestyle, pyflakes, and McCabe.
## How to use it
1. Configure the `.flake8` file in your repository's root directory with your desired rules.
2. Include the flake8 template in your CI/CD configuration (see quick use above).
3. If you need to customize the job, check
the [jobs customization](https://docs.r2devops.io/get-started/use-templates/#job-templates-customization).
## Global Configuration of Flake8
To add configuration to `flake8` shared with any other usage of flake8 (such as manual run,
pre-commit, etc), you can use `.flake8` configuration file. Learn more
about [flake8 configuration](https://flake8.pycqa.org/en/latest/user/configuration.html) files.
## Add a <a href="https://flake8.pycqa.org/"><img alt="Code style: Flake8" src="https://img.shields.io/badge/Flake8-checks-blue"></a> Badge to your project README.md
To display the use of Flake8 in your project, you can add the following badge to your README.md:
```markdown
<a href="https://flake8.pycqa.org/">
<img alt="Code style: Flake8" src="https://img.shields.io/badge/Flake8-checks-blue">
</a>
```