Skip to content

Enforce valid format options in spec tests#9021

Merged
MichaReiser merged 1 commit intomainfrom
enforce-valid-format-options
Dec 6, 2023
Merged

Enforce valid format options in spec tests#9021
MichaReiser merged 1 commit intomainfrom
enforce-valid-format-options

Conversation

@MichaReiser
Copy link
Copy Markdown
Member

@MichaReiser MichaReiser commented Dec 6, 2023

Summary

Makes serde fail when there's a unknown PyFormatOptions in a spec .options.json file.

This revealed a few tests that used incorred settings.

I re-ran the import script, which is why we now get a few updated tests.

Test Plan

Running the tests revealed some tests with invalid options, proofing the point that it now works as expected.

@MichaReiser
Copy link
Copy Markdown
Member Author

length = length_and_rest.split(" ", 1)[0]
options["line_length"] = int(length)
length = int(length)
options["line_width"] = 1 if length == 0 else length
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 isn't a valid option, so the closest we can do is to use 1.

- ** 0
-) #
+() << 0**0 #
+ **0
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed in preview style.

@MichaReiser MichaReiser added the internal An internal refactor or improvement label Dec 6, 2023
@MichaReiser MichaReiser requested a review from konstin December 6, 2023 07:05
@MichaReiser MichaReiser force-pushed the enforce-valid-format-options branch from 42c6891 to fadaddd Compare December 6, 2023 07:09
@MichaReiser MichaReiser enabled auto-merge (squash) December 6, 2023 07:12
@MichaReiser MichaReiser removed the request for review from konstin December 6, 2023 07:12
@MichaReiser MichaReiser merged commit ee6548d into main Dec 6, 2023
@MichaReiser MichaReiser deleted the enforce-valid-format-options branch December 6, 2023 07:15
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 6, 2023

ruff-ecosystem results

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant