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

Consecutive calls of poe format can make additional changes. #17

Closed
opcode81 opened this issue Jun 13, 2024 · 1 comment · Fixed by #18
Closed

Consecutive calls of poe format can make additional changes. #17

opcode81 opened this issue Jun 13, 2024 · 1 comment · Fixed by #18

Comments

@opcode81
Copy link
Contributor

opcode81 commented Jun 13, 2024

In our latest project I have repeatedly encountered a case where I would format, commit, then change an unrelated file, format again and find that it also changes the (unmodified) previously formatted file. Typically, it will add a minor thing like a trailing comma. Here's an example:

Starting point:

class SVGVariations:
    pass


class Foo:
    def create_variations_sequentially_from_example(self, example_variations: SVGVariations) -> SVGVariations:
        return example_variations

After first poe format:

class SVGVariations:
    pass


class Foo:
    def create_variations_sequentially_from_example(
        self, example_variations: SVGVariations
    ) -> SVGVariations:
        return example_variations

Second poe format:

class SVGVariations:
    pass


class Foo:
    def create_variations_sequentially_from_example(
        self,
        example_variations: SVGVariations,
    ) -> SVGVariations:
        return example_variations
@opcode81
Copy link
Contributor Author

opcode81 commented Jun 20, 2024

I found that this is caused by ruff rule COM812, which adds the trailing comma on the second run. I suppose it decides that the comma needs to be added only if the parameters are on a separate line/span more than one line.
It's a stupid rule, which we can do without.

opcode81 added a commit to opcode81/pymetrius that referenced this issue Jun 20, 2024
(calling `poe format` once does not suffice when this rule is enabled)

Ref appliedAI-Initiative#17
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

Successfully merging a pull request may close this issue.

1 participant