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

Upgrade Fantomas and add CheckFormat to build pipeline #195

Merged
merged 6 commits into from
Jul 10, 2022

Conversation

alanlomeli
Copy link
Member

@nojaf Could you give this a look please?
Also does .editorconfig needs changing?

@nojaf
Copy link

nojaf commented Jul 1, 2022

Hello @sergey-tihon, @yisusalanpng is an intern at the Open-Source team at G-Research.
He will be helping me out with some Fantomas improvements and as a learning exercise, I've asked him to upgrade Fantomas to the latest version. I hope you don't mind this PR where we update Fantomas and enforce formatting during the FAKE build.

@yisusalanpng you will need to check the Changelog file to deduce if you need to change any .editorconfig settings. Spoiler: some settings were renamed so you definitely need to address a couple of things.

@alanlomeli
Copy link
Member Author

alanlomeli commented Jul 2, 2022

All set! Looks like the same setting got renamed twice, so only that one setting needed changing.
Thanks a lot!

@sergey-tihon
Copy link
Member

Spoiler: some settings were renamed so you definitely need to address a couple of things.

Is there a "migration" story for setting? How Fantomas user should keep editorconfig up-to-date? Read release notes?

@nojaf
Copy link

nojaf commented Jul 4, 2022

I'll add some notes on how to upgrade from v4 to v5 (stable).

This is a bit of a unicorn situation where a project is using a feature that was still somewhat in development. I'm very grateful you are doing this, as it can provide some insights into how this new feature faires in the wild.

Our changelog is the source of truth to know what changed between releases.

.editorconfig Show resolved Hide resolved
value
field
specLink
obj)
Copy link
Member

Choose a reason for hiding this comment

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

@nojaf @yisusalanpng here I also a little bit surprised

    inherit SwaggerSchemaParseException(sprintf
                                             "Value `%s` is not allowed for field `%s`(See %s for more details).\nObject:%A"
                                             value
                                             field
                                             specLink
                                             obj)

why Fantoms does not insert line break before sprintf?

Copy link

Choose a reason for hiding this comment

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

There might have been an offset rule for that pre-F# 6 relaxations.
To produce valid code, we needed to put all the code after the (.
This doesn't seem a problem anymore and could be improved.
@yisusalanpng could you please report this issue using the online tool?

@nojaf
Copy link

nojaf commented Jul 6, 2022

@sergey-tihon is this good to go?
The reported bug and style guide questions won't be solved overnight (and are most likely present in the current version of Fantomas anyway).

@sergey-tihon sergey-tihon merged commit ec74b9b into fsprojects:master Jul 10, 2022
@sergey-tihon
Copy link
Member

Thank you @yisusalanpng & @nojaf for this PR

Would be nice if you can try to format https://github.com/fsprojects/FSharp.TypeProviders.SDK as well.
I believe that Fantomas still fails to parse https://github.com/fsprojects/FSharp.TypeProviders.SDK/blob/master/src/ProvidedTypes.fs

"fantomas-tool": {
"version": "5.0.0-alpha-002",
"fantomas": {
"version": "5.0.0-alpha-010",
Copy link

Choose a reason for hiding this comment

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

Ah shoot, this is already merged. @yisusalanpng I released alpha 11 on Friday. Would you mind making another PR?

@nojaf
Copy link

nojaf commented Jul 10, 2022

Great, we can take a look at that as well.

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 this pull request may close these issues.

3 participants