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

feat: Add ruff linter and formatter for Python #2043

Merged
merged 20 commits into from
Jun 6, 2024

Conversation

mattrunyon
Copy link
Collaborator

This adds the linter/formatter, but does not add user configuration yet. So I created a feature branch for it.

This is lazy loaded and only loaded if there is a Python monaco instance. You can verify by looking for wasm files in the network tab.

One thing to note is since embed-widget has its own copy of everything, I believe there would be 2 copies of the wasm in DHC which is not great.

@mattrunyon mattrunyon requested a review from mofojed May 29, 2024 19:07
@mattrunyon mattrunyon self-assigned this May 29, 2024
Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

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

Boom

@mattrunyon mattrunyon requested a review from mofojed May 30, 2024 19:34
.github/workflows/e2e.yml Outdated Show resolved Hide resolved
packages/console/src/monaco/ruff/ruff_wasm.js Outdated Show resolved Hide resolved
}

async handleSaveFromShortcut(): Promise<void> {
await this.handleFormat();
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should auto format on save by default unless the user has opted in, configured the formatting settings, or has otherwise been notified this will be occurring. Imposing our preferred formatting settings on others without their approval is likely to annoy people.
I know this is going into a feature branch, but I think important to call that out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I commented this out for now and added a TODO comment to check if the user enabled format on save.

You can still format from the overflow menu on this branch

@mattrunyon mattrunyon requested a review from mofojed June 4, 2024 20:47
@mattrunyon mattrunyon merged commit 2bf15a9 into deephaven:feature/python-formatter Jun 6, 2024
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants