Skip to content

CI,STYLE: narrow down ignore-words-list of codespell #38847

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

Merged
merged 3 commits into from
Jan 4, 2021
Merged

CI,STYLE: narrow down ignore-words-list of codespell #38847

merged 3 commits into from
Jan 4, 2021

Conversation

chinggg
Copy link
Contributor

@chinggg chinggg commented Dec 31, 2020

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @chinggg !

@MarcoGorelli MarcoGorelli added the Code Style Code style, linting, code_checks label Dec 31, 2020
@MarcoGorelli MarcoGorelli added this to the 1.3 milestone Dec 31, 2020
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

I am personally -1 on using the codespellignorelines like this. IMO that will become too complex. A code check is nice, but should not become too convoluted or get in the way (eg now if someone changes one of those lines slightly, you get linting errors and need to update codespellignorelines as well)

@@ -0,0 +1,7 @@
1 fo
end_types = {"M", "A", "Q", "BM", "BA", "BQ", "W"}
Copy link
Member

Choose a reason for hiding this comment

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

The strings on this line are simply valid arguments in pandas for frequencies. So they can also appear elsewhere, IMO just ignoring this line is too brittle, and I would personally leave this as a global ignored word.

@MarcoGorelli
Copy link
Member

That's a good point, thanks @jorisvandenbossche

So, do you suggest to keep this PR's renaming of datas -> data, but put fo and ba back into ignore-words-list, remove .codespellignorelines, and remove the exclude-file option in setup.cfg?

@chinggg
Copy link
Contributor Author

chinggg commented Jan 2, 2021

@MarcoGorelli I agree with @jorisvandenbossche to remove the .codespellignorelines file and bring ba and fo back into the ignore-words-list. Otherwise it may be convoluted and brittle as @jorisvandenbossche pointed out.

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

Thanks @chinggg for updating! It's showing 101 files changed though, something may have gone wrong while merging - could you try again please?

@chinggg
Copy link
Contributor Author

chinggg commented Jan 3, 2021

@MarcoGorelli I fetch from upstream/master before I commit my modification, so the commits others have done are merged. Do I need to fetch from the upstream before I commit or the PR system will deal with the my version which have fallen behind the upstream to be merged correctly?

@MarcoGorelli MarcoGorelli self-requested a review January 3, 2021 08:49
@MarcoGorelli
Copy link
Member

@chinggg it's fine to fetch before adding new commits, but that shouldn't show so many changed files - without seeing the exact commands you ran, it's hard to guess what may have gone wrong

I think now I'd suggest

git rebase upstream/master
git push -f

, when trying that locally from your branch it works fine

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

This looks better, thanks @chinggg !

@jorisvandenbossche further comments?

setup.cfg Outdated
@@ -64,7 +64,7 @@ filterwarnings =
junit_family=xunit2

[codespell]
ignore-words-list=ba,blocs,coo,datas,fo,hist,nd,ser
ignore-words-list=ba,blocs,coo,fo,hist,nd,ser
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to just ignore pandas/core/strings/accessor.py instead / in-addition to?

Copy link
Member

Choose a reason for hiding this comment

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

as in, ignore the whole file? Yes, that's easily done with

exclude: ^pandas/core/strings/accessor\.py$

in .pre-commit-config.yaml, it's just not clear to me why that would be preferrable

Copy link
Contributor

Choose a reason for hiding this comment

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

to avoid the fragility of 'fo'

Copy link
Member

Choose a reason for hiding this comment

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

@jreback an alternative would be to change the example to use 'nox' instead of 'fox' - which isn't a real animal, but at least then no is a real word and we avoid having to ignore an entire file, does that seem OK?

Copy link
Contributor

Choose a reason for hiding this comment

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

i would rather just ignore that example if we can. it IS pretty fragile. its not likely to change much in the future though, so i suppose if you can't ignore that line then just changing the example is prob ok.

Copy link
Member

Choose a reason for hiding this comment

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

OK if we use dog then there's no failures and we can use a real animal 🎉

The original PR changed the example actually, before I asked them to change (sorry @chinggg !) so I've added a commit for them - look good now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah! Thanks @MarcoGorelli , it looks good to me.

@MarcoGorelli MarcoGorelli self-requested a review January 3, 2021 18:10
@jreback jreback merged commit 0efb5e8 into pandas-dev:master Jan 4, 2021
@jreback
Copy link
Contributor

jreback commented Jan 4, 2021

thanks @chinggg

luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants