flake8-picky-parentheses

0.6.2 · active · verified Thu Apr 16

flake8-picky-parentheses is a flake8 plugin that enhances code style checks by nitpicking about the usage and alignment of parentheses, brackets, and braces. It provides two main types of checks: identifying redundant parentheses (PAR0xx codes) and enforcing opinionated alignment rules for multi-line expressions (PAR1xx codes). The library is actively maintained, frequently updating to ensure compatibility with the latest Python versions and flake8 releases, with its current version being 0.6.2.

Common errors

Warnings

Install

Quickstart

Create a file named `bad_code.py` with the content above. Run flake8 with `flake8-picky-parentheses` to detect redundant parentheses (PAR0xx) and alignment issues (PAR1xx). The `--select` option ensures only this plugin's errors are shown.

import os

def my_function():
    if (True):  # PAR001: Redundant parentheses (general)
        result = ((1 + 2) * 3)  # PAR001: Redundant parentheses (general)
    else:
        result = (
            4 + 5 # PAR101: Opening bracket is last, but closing is not on new line
        ) * 6

    (a,) = 'b' # PAR002: Parentheses used for tuple unpacking
    return a

view raw JSON →