autopep8 icon indicating copy to clipboard operation
autopep8 copied to clipboard

JSON long strings aren't formatted

Open vivekpatani opened this issue 5 years ago • 1 comments


Python Code

import json

whatever_json = {
    "name": "JSON Error",
    "long string": "This sentence is so long that it breaks the autopep autoformatter, or am I doing something wrong? It would be great to know. Thanks.",
    "Awesome": "Tool btw"
}


def doing_json_things():
    """Doing JSON things.
    """
    print(whatever_json)

Command Line and Configuration

Command Line

$ autopep8 --in-place --aggressive --aggressive test.py

Your Environment

  • Python version: 2.7.15
  • autopep8 version: 1.4.4
  • Platform: macOSX

vivekpatani avatar Apr 18 '19 23:04 vivekpatani

This case does nothing with pycodestyle and autopep8 .

Strings with a long token itself are difficult to split or break. If you have any good ideas or patches, welcome :)

hhatto avatar Feb 21 '20 00:02 hhatto