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

Add fix for operators #129

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

nielsdebruin
Copy link
Contributor

What's changed?

This PR adds many more tests for the around operators and corrects some bugs.

What's your motivation?

Anything in particular you'd like reviewers to focus on?

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@nielsdebruin nielsdebruin added bug Something isn't working enhancement New feature or request labels Jan 23, 2025
@nielsdebruin nielsdebruin self-assigned this Jan 23, 2025

def visit_variable(self, named_variable: VariableDeclarations.NamedVariable, p: P) -> J:
v = cast(VariableDeclarations.NamedVariable, super().visit_variable(named_variable, p))
if v.padding.initializer is not None and v.padding.initializer.element is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we here probably need to limit this to method parameter declarations. Currently this would also apply to other variables (e.g. class fields or local variables). Or does the IntelliJ setting also apply to other types of variables?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that this code is only relevant for the eq_in_named_parameter and, more specifically, when it's set to False, which is not the default. I am not quite sure what the best approach here would be, so for now, I removed the snippet from this PR as the rest of the operators are independent.

Copy link
Contributor

Choose a reason for hiding this comment

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

The trick would be to use the cursor to check if the parent tree is a method declaration.

@nielsdebruin nielsdebruin marked this pull request as ready for review January 23, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants