hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.56k stars 290 forks source link

--hang-closing does not work for non-indented lines #612

Closed ortk95 closed 2 years ago

ortk95 commented 2 years ago

When --hang-closing is used, closing brackets for variables on non-indented lines are not corrected.


Python Code

Input

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
x = [
    None
]  # Not corrected by autopep8

if True:
    y = [
        None
    ]  # Corrected by autopep8

Output

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
x = [
    None
]  # Not corrected by autopep8

if True:
    y = [
        None
        ]  # Corrected by autopep8

Command Line and Configuration

Command Line

$ autopep8 --hang-closing test.py

Your Environment

hhatto commented 2 years ago

@ortk95 Thanks for reporing. fix this on latest master branch. 68ad2003fedbe23934ed88d72d544fe267f46431

We will be releasing version 1.6 within the next few days.

ortk95 commented 2 years ago

Thanks!