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

Replace Black with Ruff, add LSP plugin for Ruff #902

Merged
merged 11 commits into from Mar 3, 2024
Merged

Conversation

theCapypara
Copy link
Contributor

@theCapypara theCapypara commented Mar 3, 2024

⚠️ The demos repo needs to be updated (Makefile and format+lint fixes at least)

I decided to go ahead with trying to implement Ruff. Ruff implements a linter and a formatter. I added https://github.com/python-lsp/python-lsp-ruff for Ruff support for the existing LSP.

This removes Black and replaces it with Ruff. Ruff also runs linting.

Closes #804.

@theCapypara
Copy link
Contributor Author

There's also a python-language-server Ruff plugin:
https://github.com/python-lsp/python-lsp-ruff

We should be using that instead probably!

@theCapypara theCapypara marked this pull request as ready for review March 3, 2024 20:03
@theCapypara theCapypara requested a review from sonnyp as a code owner March 3, 2024 20:03
@theCapypara theCapypara changed the title Replace Black with Ruff, add Ruff LSP Replace Black with Ruff, add LSP plugin for Ruff Mar 3, 2024
Makefile Outdated Show resolved Hide resolved
meson.build Outdated Show resolved Hide resolved
ruff.toml Outdated
"E402", # Module level import not at top of file -> gi imports may come after gi.require_version.
"E501", # Line too long. This is probably better enforced manually where it makes sense.
]
select = [ "W", "E", "F", "ARG"]
Copy link
Contributor

Choose a reason for hiding this comment

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

please move this file to langs/python
or copy

let's use 2 separate files, one for Workbench internal and one for Workbench source

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by two files?
I will move it to langs/python for now, but this makes running it locally a bit more complicated, though it's not a big issue since I can just configure it in the Makefile.

Copy link
Contributor

Choose a reason for hiding this comment

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

we should use 2 separate configs anywya

1 for python source files in Workbench
1 for the LSP / formatter in Workbench

We'll want different rules

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we keep it one file for now? We can split it up later if needed anyway.

Workbench only has a handful of Python files internally, I doubt we couldn't use the same rule. I want to keep the rules as simple as possible in any case.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure

src/common.js Outdated Show resolved Hide resolved
src/langs/python/PythonDocument.js Outdated Show resolved Hide resolved
src/lsp/LSPClient.js Outdated Show resolved Hide resolved
src/common.js Outdated Show resolved Hide resolved
src/common.js Outdated Show resolved Hide resolved
@theCapypara theCapypara requested a review from sonnyp March 3, 2024 21:45
Copy link
Contributor

@sonnyp sonnyp left a comment

Choose a reason for hiding this comment

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

@sonnyp sonnyp merged commit 6f201f9 into main Mar 3, 2024
1 check passed
@sonnyp sonnyp deleted the capypara/add-ruff branch March 3, 2024 22:40
Hofer-Julian pushed a commit that referenced this pull request Mar 24, 2024
Co-authored-by: Sonny Piers <sonny@fastmail.net>
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.

Python: Linting
2 participants