Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixer for E1,W191 causes E122,E123 or E126 #668

Open
spaceone opened this issue Jan 12, 2023 · 0 comments
Open

fixer for E1,W191 causes E122,E123 or E126 #668

spaceone opened this issue Jan 12, 2023 · 0 comments

Comments

@spaceone
Copy link
Contributor

The following code (indented with tabs):

def foo(openapi_schemas):
	openapi_schemas[f'{model_name}.response-mixin'] = {
		"type": "object",
		"properties": {
			"_links": {
				"$ref": '#/components/schemas/_links',
			},
			"_embedded": {
				"$ref": '#/components/schemas/_embedded',
			},
			"uuid": {
				"$ref": '#/components/schemas/uuid',
			},
			"objectType": {
				"$ref": '#/components/schemas/objectType',
			},
			# "id": {"$ref": '#/components/schemas/id',},
			"uri": {
				"$ref": f'#/components/schemas/{_openapi_quote(model_name + ".uri")}',
			},
		},
	}

will be transformed incorrectly (without specifying args or with --select E1,W191) into:

def foo(openapi_schemas):
    openapi_schemas[f'{model_name}.response-mixin'] = {
        "type": "object",
        "properties": {
                "_links": {
                    "$ref": '#/components/schemas/_links',
                },
            "_embedded": {
                    "$ref": '#/components/schemas/_embedded',
                },
            "uuid": {
                    "$ref": '#/components/schemas/uuid',
            },
            "objectType": {
                    "$ref": '#/components/schemas/objectType',
            },
            # "id": {"$ref": '#/components/schemas/id',},
            "uri": {
                    "$ref": f'#/components/schemas/{_openapi_quote(model_name + ".uri")}',
            },
        },
    }

causing therefore

foo.py:13:13: E122 continuation line missing indentation or outdented
foo.py:16:13: E122 continuation line missing indentation or outdented

When specifying --select E101,W191 it looks better but it's indented with 8 spaces instead of 4 causing:

bar.py:3:13: E126 continuation line over-indented for hanging indent
bar.py:6:29: E126 continuation line over-indented for hanging indent
bar.py:8:21: E126 continuation line over-indented for hanging indent
bar.py:9:29: E126 continuation line over-indented for hanging indent
bar.py:12:29: E126 continuation line over-indented for hanging indent
bar.py:15:29: E126 continuation line over-indented for hanging indent
bar.py:19:29: E126 continuation line over-indented for hanging indent

with --ignore E122 --hang-closing it's completely broken and the } are not indented anymore at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant