Skip to content

Fix introduced a syntax error with PIE800 #15366

@hauntsaninja

Description

@hauntsaninja
λ cat test.py
class L:
    def execute(self):
        return {
            "data": [],
            **({"count": 1 if include_count else {}}),
        }

λ uvx ruff@0.8.6 check test.py --select PIE --no-cache --fix 

error: Fix introduced a syntax error. Reverting all changes.

This indicates a bug in Ruff. If you could open an issue at:

    https://github.com/astral-sh/ruff/issues/new?title=%5BFix%20error%5D

...quoting the contents of `test.py`, the rule codes PIE800, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

test.py:5:16: PIE800 Unnecessary spread `**`
  |
3 |         return {
4 |             "data": [],
5 |             **({"count": 1 if include_count else {}}),
  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PIE800
6 |         }
  |
  = help: Remove unnecessary dict

Found 1 error.
[*] 1 fixable with the `--fix` option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixesRelated to suggested fixes for violations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions