Metadata-Version: 2.1
Name: flake8_assignment_expressions
Version: 1.0.0
Summary: A flake8 plugin that disallows assignment expressions
Home-page: https://github.com/GambitingMan/flake8_assignment_expressions
Author: Nermin Dedovic
Author-email: nermin_dedovic@hotmail.com
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

# flake8_expression_assignments

A flake8 plugin that disallows assignment expressions.

## Installation

`pip install flake8_assignment_expressions`

## Flake8 codes

| Code   | Description                                            |
|--------|--------------------------------------------------------|
| ASE101 | Line contains assignment expression                    |

## Why

Assignment expressions/the walrus operator was introduced in Python 3.8.
If you want to keep assignment expressions out of your own or your companies'
repositories, use this plugin.

This plugin will encourage you to rewrite code like

```python
import os

if environment := os.getenv("ENVIRONMENT"):
    print(f"You are currently on the {environment} environment.")
```

into

```python
import os

environment = os.getenv("ENVIRONMENT")
if environment:
    print(f"You are currently on the {environment} environment.")
```

## Running as a pre-commit hook
See [pre-commit](https://github.com/pre-commit/pre-commit) for instructions.

Sample `.pre-commit-config.yaml`:

```yaml
-   repo: https://github.com/pycqa/flake8
    rev: 4.0.1
    hooks:
    -   id: flake8
        additional_dependencies: [flake8_assignment_expressions]
```


