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: Ruff Python formatter and linter #2233

Merged
merged 7 commits into from
Sep 26, 2024
Merged

Conversation

mattrunyon
Copy link
Collaborator

Fixes #1255

(This might not actually be breaking, it's more just notes for implementing in DHE)
BREAKING CHANGE:
The app should call MonacoUtils.init with a getWorker function that uses the JSON worker in addition to the general fallback worker when adding support for configuring ruff.

Fixes #1255 

I need to test this doesn't crash if using groovy. Not sure if the ruff
version is available without initializing ruff first or what happens if
it's unavailable.

- Added global setting for minimap, format on save, formatter, and
formatting settings
- Added format on save option and format button to notebook overflow
menu
- Format on save triggers on both shortcut and pressing the save button
- Config editor has JSON schema included
- Config editor cannot be closed by clicking outside the modal, but can
be closed w/ escape key

Something we should add maybe as part of this PR or a final follow-up to
this feature branch is disabling certain/all linting/formatting for the
console. One way we might do this is by registering the console w/ a
specific URI or URI scheme so we can check it when checking if we should
lint. Or include it as a prop to the `MonacoProviders` component. This
would require some changes to the current setup of setting/using the
config on `MonacoProviders` static members/methods

(This might not actually be breaking, it's more just notes for
implementing in DHE)
BREAKING CHANGE:
The app should call `MonacoUtils.init` with a `getWorker` function that
uses the JSON worker in addition to the general fallback worker when
adding support for configuring ruff.
@mattrunyon mattrunyon requested a review from mofojed September 20, 2024 19:19
@mattrunyon mattrunyon self-assigned this Sep 20, 2024
Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 9.37500% with 232 lines in your changes missing coverage. Please review.

Project coverage is 46.58%. Comparing base (ec9b41e) to head (2778f27).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/console/src/monaco/MonacoProviders.tsx 4.08% 94 Missing ⚠️
packages/console/src/monaco/RuffSettingsModal.tsx 4.16% 46 Missing ⚠️
...ashboard-core-plugins/src/panels/NotebookPanel.tsx 0.00% 39 Missing ⚠️
.../code-studio/src/settings/EditorSectionContent.tsx 0.00% 33 Missing ⚠️
...ges/app-utils/src/storage/LocalWorkspaceStorage.ts 0.00% 9 Missing ⚠️
packages/code-studio/src/AppRoot.tsx 0.00% 5 Missing ⚠️
packages/console/src/monaco/MonacoUtils.ts 37.50% 5 Missing ⚠️
packages/react-hooks/src/usePromiseFactory.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2233      +/-   ##
==========================================
- Coverage   46.61%   46.58%   -0.03%     
==========================================
  Files         692      698       +6     
  Lines       38508    39238     +730     
  Branches     9826    10098     +272     
==========================================
+ Hits        17949    18280     +331     
- Misses      20506    20945     +439     
+ Partials       53       13      -40     
Flag Coverage Δ
unit 46.57% <9.37%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mofojed
mofojed previously approved these changes Sep 24, 2024
@mattrunyon mattrunyon merged commit 4839d72 into main Sep 26, 2024
19 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2024
@mattrunyon mattrunyon deleted the feature/python-formatter branch September 26, 2024 21:40
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.

Automatic code formatting for notebooks
2 participants