GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow setting `pylsp.plugins.ruff.format` to `["ALL"]` by willjow · Pull Request #101 · python-lsp/python-lsp-ruff

Conversation

@willjow

@willjow willjow commented Oct 25, 2024

Copy link
Copy Markdown

I'm a new user of ruff, so apologies if this is not intended usage!

When setting up my ruff config, I thought it might be fun to aggressively format using all of ruff's rules in the absence of any project settings.

However, it appears that the ignore option dominates the select option for ruff check if the same rule code is specified in each. Thus, the plugin will not currently work as expected if pylsp.plugins.ruff.format is set to ["ALL"].

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
willjow added 2 commits October 24, 2024 16:29
@willjow
Don't ignore the "ALL" rule if it is in format
55a170c
In this case, the ignore will take precedence and setting
`pylsp.plugins.ruff.format` to `["ALL"]` will do nothing.
@willjow
Add a test case to test_ruff_format.py
fb54915
Update existing test text to be compatible with the case that a format
is run with `format` set to `["ALL"]`.
willjow
willjow commented Oct 25, 2024
View reviewed changes
Comment thread pylsp_ruff/plugin.py
new_text = run_ruff(
settings=PluginSettings(
ignore=["ALL"],
ignore=["ALL"] if "ALL" not in settings.format else [],

@willjow willjow Oct 25, 2024

Copy link
Copy Markdown
Author

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.

This is admittedly a bit of a quick and dirty patch; would it be preferred to track this condition when the settings are parsed?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/test_ruff_format.py
assert want == got


def test_ruff_format_via_all(workspace):

@willjow willjow Oct 25, 2024

Copy link
Copy Markdown
Author

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.

This is somewhat of a fragile thing to test since it's at the mercy of whatever rules ruff might add. The tested text might be reasonably robust, but it also might be best to just leave this out.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@willjow
willjow marked this pull request as ready for review October 25, 2024 04:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@willjow
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.