Skip to content

STYLE enable ruff PLR5501 #51709

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

Closed
MarcoGorelli opened this issue Mar 1, 2023 · 29 comments · Fixed by #51747
Closed

STYLE enable ruff PLR5501 #51709

MarcoGorelli opened this issue Mar 1, 2023 · 29 comments · Fixed by #51747
Assignees
Labels
Code Style Code style, linting, code_checks good first issue

Comments

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Mar 1, 2023

Task is:

  1. check the contributing guide for how to set up your environment
  2. remove PLR5501 from

pandas/pyproject.toml

Lines 274 to 275 in 4d18871

# Consider `elif` instead of `else` then `if` to remove indendation level
"PLR5501",

  1. run pre-commit run ruff --all-files
  2. fixup the errors it flags
  3. stage, commit, push, open pull request
@MarcoGorelli MarcoGorelli added Code Style Code style, linting, code_checks good first issue labels Mar 1, 2023
@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 1, 2023

Hi! can i help with this problem.

@MarcoGorelli
Copy link
Member Author

go ahead

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 1, 2023

How can i run code to check for errors?

@MarcoGorelli
Copy link
Member Author

step 3 from #51709 (comment)

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 1, 2023

hey! soory to bother again.
i am having this issue i hav pre commit installed but whenever i use it this error comes up
pre-commit : The term 'pre-commit' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again

do u know solution??

@MarcoGorelli
Copy link
Member Author

did you follow the contributing guide? https://pandas.pydata.org/docs/dev/development/contributing_environment.html

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 1, 2023

Yes i did I installed with docker

@MarcoGorelli
Copy link
Member Author

perhaps try gitpod then

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 1, 2023

sure i will give it a try thanks for help

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 1, 2023

does this issue want to remove "PLR5501" from whole code???

@MarcoGorelli
Copy link
Member Author

you could add pandas/core/* to the per-file-ignores (in pyproject.toml) for this code and just do the rest if it's too much to do in one go. that might be better actually

@MarcoGorelli
Copy link
Member Author

as in, to add

# to be enabled gradually
"pandas/core/*" = ["PLR5501"]

here in this section:

pandas/pyproject.toml

Lines 288 to 290 in 4d18871

[tool.ruff.per-file-ignores]
# relative imports allowed for asv_bench
"asv_bench/*" = ["TID"]

Then there shouldn't be too many to fixup

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 1, 2023

sure thanks

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 1, 2023

ok so it says "Found 30 errors." should i start with this

@MarcoGorelli
Copy link
Member Author

yup, thanks!

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 1, 2023

Ok I will start tomorrow its 11pm rn.

@MarcoGorelli
Copy link
Member Author

😄 sure thing, good night 🛌

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 2, 2023

Take

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 2, 2023

Hey, wanted to ask how can i use --fix

@MarcoGorelli
Copy link
Member Author

i don't think you can for this particular code, you'll have to do it manually

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 2, 2023

no i left some blank space i wanted to use it for that

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 2, 2023

*] 4 potentially fixable with the --fix option.

@MarcoGorelli
Copy link
Member Author

you can run it via the command line, just make sure you have the same version installed as is in the pre-commit-config.yaml file

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 2, 2023

Hey, i passed those tests. should i fix rest of those errors now after removing "pandas/core/*" = ["PLR5501"] ???

@MarcoGorelli
Copy link
Member Author

you can open a PR

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 2, 2023

ok

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 2, 2023

my branch is few commit behind what sholud i do?

@MarcoGorelli
Copy link
Member Author

you can just open a pr

@ahmad-04
Copy link
Contributor

ahmad-04 commented Mar 2, 2023

Done PR that took some time it was first PR ever.

MarcoGorelli pushed a commit that referenced this issue Mar 7, 2023
* Removed PLR5501

* 7 elif changed

* 8 more

* more fixess

* moreeeeeeeee changes

* fix python_parser.py (try #1)

* try no. 2

* fix python_parser.py (try no. 3)

* v2.1.0 (fix try 1)

* try no. 2

* Removed extra lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants