-
Notifications
You must be signed in to change notification settings - Fork 301
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
[Python] Use Fantomas formatting and check CI #2738
Conversation
@dbrattli Some of the code base in Fable comes from |
@ncave It's possible to ignore parts of the code-base using |
|
||
let path = | ||
match relative, normalizedPath with | ||
| _, "" -> "" | ||
| true, "." -> "." | ||
| true, path -> | ||
path // translate path to Python relative syntax | ||
path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantomas has removed the comment here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've seen this happen a couple of times. Added issue at: fsprojects/fantomas#2027
Yes, I've been thinking about adding Fantomas many times, but at the end I discarded by issues like the one pointed out by @ncave. Particularly right now it can make keeping |
Ok, thanks for the comments. It makes sense to wait with this until after beyond merges with main. I'll still add this for Python to test if it can work, but will remove the CI hook if it becomes to annoying for the rest of you. |
So this PR might be a bit controversial with Fable 😬 but I think it's mostly a good thing with a common code style when we have many contributors. So starting with Python related code we will now enforce the formatting based on the latest Fantomas 4.6 (set as a dotnet tool) and the rules set in .editorconfig. I'm pretty agnostic to what the rules should be as long as we have a set of common rules. The current .editorconfig tries to match the current code style, but please make PR's to modify if to the Fable style.
This PR will only enforce the formatting of
src/Fable.Transforms/Python
but we should consider adding this to the rest of the code base as well.To format the Python code, you will need to run:
Fantomas is added to GitHub actions so if the Python related code is not formatted according to the rules, the build will fail. Please chime in if you do not want this kind of restrictions in Fable (even if only applied to the Python specific code) @alfonsogarciacaro @ncave