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 — lint: add typos check by Borda · Pull Request #1888 · gitpython-developers/GitPython

Conversation

@Borda

@Borda Borda commented Mar 31, 2024

Copy link
Copy Markdown
Contributor

Just a suggestion to add a check for typos and maybe let's fix some without breaking API

Sorry, something went wrong.

Uh oh!

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

All reactions
Borda
Borda commented Mar 31, 2024
View reviewed changes
Comment thread test/fixtures/commit_with_gpgsig Resolved

Uh oh!

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

Borda
Borda commented Mar 31, 2024
View reviewed changes
Comment thread README.md Resolved

Uh oh!

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

@Borda
Borda marked this pull request as draft March 31, 2024 20:47
@EliahKagan

EliahKagan commented Mar 31, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

I've noticed a considerable number of areas in the diff where correct names are made incorrect ("rela" stands for "relative" and I don't think there are any occurrences where it should be changed to "real", and there are some others). This is not limited to the GPG signature and project-name cases that you've identified. In addition, I'm not sure any changes should be made in files in test/fixtures that are used as test repository contents.

However, I've also noticed that you've marked this as a draft, and maybe you aware of the other issues. If you think it would be helpful for me to leave a review with comments on the individual problematic cases, I'd be pleased to do so. Otherwise I will assume as long as this is a draft that such a review might be more of a distraction than a help, and refrain from it.

There are also some areas where at least the fixes are clearly a huge improvement, particularly in test/test_index.py where it had not even occurred to me that, because of the way pytest marks work, I could misspell raises and accidentally write xfail marks that don't enforce specific exception types. At minimum, that should certainly be fixed. Hopefully the idea here will work out in some form, but even if not, I can't speak for you or for Byron but from my perspective the effort so far is worth it just for finding that.

All reactions

Sorry, something went wrong.

Uh oh!

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

This was referenced Mar 31, 2024
Don't suppress pytest warning summaries #1892
Merged
Some xfail markings fail to validate their exception types #1893
Closed
@EliahKagan

EliahKagan commented Apr 1, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

To make sure it is not lost track of, and also to report the results of some manual testing because the affected xfail markings cover some things not produced on CI, I've opened #1893 for the bug you've discovered in test_index.py here. This is the bug where three of the xfail markings pass misspelled keyword arguments that attempt unsuccessfully to cause the test to report an unexpected failure if the exception is not as declared. It differs from some of the other misspellings found here because it affects the behavior of the tests and can cause an unexpected failure to be wrongly reported as an expected failure.

Although those are definitely not the only typos found here that should be fixed, it seems to me that their elevated importance and relationship to the correctness of the tests justifies a separate PR to fix them, especially if such a PR would result in their being fixed sooner (and then they would no longer have to be worried about here).

If you are amenable to this idea, then I suggest opening that, as you deserve the credit for it. But I would be pleased to open that PR instead if you prefer (I would list you in the Co-authored-by trailer).

While another option may be to wait for the change to come in with this PR, I think it is better that it not be delayed while figuring out if and how automated spell checking can be added safely and with an acceptably low rate of false positives.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Byron

Byron commented Apr 2, 2024

Copy link
Copy Markdown
Member

Thanks for sharing this draft, I am happy it could already find a genuine issue (#1893) despite a high rate of false positives.
My feeling here is that given that high amount and known issues in the underlying engine, trying to make this work beyond what's here won't be worth it. But that will be for @Borda to decide, and I'd appreciate such a decision so the PR won't stay open for too long.

Thank you

All reactions

Sorry, something went wrong.

Uh oh!

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

@Borda

Borda commented Apr 2, 2024

Copy link
Copy Markdown
Contributor Author

With my other projects, I have been using several typing tools, and this seems to be at first, lower effort, but as mentioned, it produces a significant number of false positives, and with the next version, there could be even more (just opened issues for crate-ci/typos#966 and crate-ci/typos#969)

So I'll open a separate PR for the fixes and most likely pivot this PR to use another typing alternative :)

Byron and EliahKagan reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

@Borda

Borda commented May 7, 2024

Copy link
Copy Markdown
Contributor Author

pivoting to https://github.com/codespell-project/codespell

All reactions

Sorry, something went wrong.

Uh oh!

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

@Borda

Borda commented May 7, 2024

Copy link
Copy Markdown
Contributor Author

@EliahKagan @Byron, would you mind having a look at the updated version?
Not sure what to do about doesnt, which is used as a file name... 🐿️

All reactions

Sorry, something went wrong.

Uh oh!

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

@Borda
Borda marked this pull request as ready for review May 7, 2024 17:40
Byron
Byron approved these changes May 7, 2024
View reviewed changes

@Byron Byron left a comment

Copy link
Copy Markdown
Member

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.

Thanks a lot for making it happen!

Now it looks like the tool is usable, and it's nice to see that it caught a couple of real errors.

I will wait for @EliahKagan approval though before merging in case I am missing some more obscure aspects of the tool and as it's integrated into the tooling of GitPython.

Sorry, something went wrong.

Uh oh!

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

Borda reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread git/objects/util.py Resolved

Uh oh!

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

Comment thread git/util.py Resolved

Uh oh!

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

EliahKagan
EliahKagan requested changes May 26, 2024
View reviewed changes

@EliahKagan EliahKagan left a comment •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

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.

I think the keyword argument spelling fixes in test/test_index.py justify adding automated spell-checking, even though various cases remain where spell-checking seems to have led to incorrect or sub-optimal changes.

These can be fixed, and the risk that spell-checking would lead to such cases being introduced later is, in my opinion, outweighed by the benefits of catching misspellings that, due to the dynamic nature of Python and its idiomatic uses, may affect the behavior of GitPython or its tests.

I've looked at each change and commented about the ones that I think should not be done or otherwise still need improvement. Some comments cover multiple changes, so the absence of a comment on a specific change does not mean that I think it is correct.

I recommend that this PR be marked as fixing #1893.

Edit: If Cygwin tests fail with "dubious ownership" errors when more commits are pushed to this pull request, that is not any fault of this PR, but also happens without the changes here. I've opened #1916 to fix it. If that pull request is merged, then merging from main or (perhaps better) rebasing this PR feature branch onto main should allow new Cygwin runs to pass here too.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread git/index/base.py Outdated
try:
for root, _dirs, files in os.walk(abs_path, onerror=raise_exc):
for rela_file in files:
for relative_fpath in files:

@EliahKagan EliahKagan May 26, 2024

Copy link
Copy Markdown
Member

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.

Why is the name relative_fpath better than rela_file? Why was this chosen instead of relative_path? If the f in fpath is unimportant, then it should be removed. If it is important, then it should be spelled out. If explicitness is not required, then presumably rela_file is also okay, in which case it should not be changed just to make the spell checker happy.

This applies to most occurrences of relative_fpath, including in other files.

My guess is that this should be relative_path. The nonpublic _items_to_rela_paths method was renamed to _items_to_relative_paths. Assuming that change is good, which I think it is, it seems like relative_fpath should just be relative_path.

Sorry, something went wrong.

Uh oh!

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

All reactions

@Borda Borda May 30, 2024

Copy link
Copy Markdown
Contributor 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.

rela was marked as typo so I found easier to use full name without affecting API

Sorry, something went wrong.

Uh oh!

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

All reactions

@EliahKagan EliahKagan May 30, 2024

Copy link
Copy Markdown
Member

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.

I don't think relative_fpath is a full name. It looks like a typo that is meant to be relative_path without the f.

Maybe it is not a typo. Maybe f is an abbreviation for something that should be spelled out (if important) or omitted (if unimportant).

The key point is that I do not know what relative_fpath means in the places where this PR has introduced it, and I have not been able to figure that out. (I have been able to guess that the f stands for "file," but I am not certain of this, and without knowing the old variable name rela_file, I would likely not even have been able to guess this.) I expect that other current or future readers may also not know what it means.

I recommend changing it, probably to relative_path.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread git/objects/util.py Resolved

Uh oh!

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

Comment thread git/refs/symbolic.py Resolved

Uh oh!

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

Comment thread git/remote.py Outdated
elif "[new branch]" in summary:
flags |= cls.NEW_HEAD
# uptodate encoded in control character
# up-to-date encoded in control character

@EliahKagan EliahKagan May 26, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

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 change may seem at first glance to be obviously correct, but I think it actually may be wrong, and that if it is to be kept then it requires a specific technical justification.

I think uptodate is a specific technical term in Git. In the Git source code, it often appears capitalized, but it also appears lower-case in multiple places, which also seems to be intentional. As one example, in fetch.c:

		/* uptodate lines are only shown on high verbosity level */
		if (verbosity <= 0 && oideq(&ref->peer_ref->old_oid, &ref->old_oid))
			continue;

It seems like that specific technical meaning is the one relevant here. If this has been verified not to be the case, then the change here is okay. Otherwise, either the change should be undone and uptodate added as a correct spelling, or it should be investigated.

Although this feels minor, making technical terms harder to search for can accumulate and make a codebase difficult to work with. That is both potentially relevant to this specific change, and a potential risk of automated spell-checking.

Sorry, something went wrong.

Uh oh!

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

All reactions

@Borda Borda Jul 17, 2024

Copy link
Copy Markdown
Contributor 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.

I think in this case making it a command associate would be better

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread pyproject.toml Outdated
]

[tool.codespell]
skip = 'test/fixtures/reflog_*'

@EliahKagan EliahKagan May 26, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

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.

I don't think any of the files in fixtures that represent test input or expected output should be spell-checked. I think the *.py files in fixtures, which are actually run as code, should be spell-checked, and that other files should not.

It seems to me that the question to ask is, if code appearing inside a fixture were found to have a logic error, should that bug be fixed? A number of fixture files have Ruby code or diffs thereof, but these are just test data. If logic errors in that code (which isn't run) shouldn't be fixed, then either the same files should not be spell-checked, or the justification for spell-checking them should be made clear. The issues with these kinds of changes are:

  1. Churn in test data may make it so that changes to test data that are actually done to improve the tests are hard to identify.
  2. Changes in test data need to be reviewed to evaluate whether they could have any impact on the tests. It is possible, in general, for a change to test data to keep a test passing, while preventing it from catching regressions that it would have caught before the test data changed.

The first concern is minor and may well be overcome by the slight readability improvement of avoiding typos. The second concern is less minor and it seems to me that this is not worth the risk, even if small. Tests can assert things that are affected by the presence or absence of specific strings or that involve specific lengths.

This also applies to all changes in test/fixutres/diff_mode_only. I have not posted separate comments there.

Edit: See also #1920 (review).

Sorry, something went wrong.

Uh oh!

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

All reactions

@Borda Borda Jul 16, 2024

Copy link
Copy Markdown
Contributor 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.

yes all sounds reasonable to me, so how about splitting this into two PRs?

  • add typos check with exclude fixtures
  • revisit fixtures' typos and eventually remove ignoring this folder from typo's check

Sorry, something went wrong.

Uh oh!

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

EliahKagan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@Byron Byron Jul 17, 2024

Copy link
Copy Markdown
Member

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.

@EliahKagan Did you see this message?

Sorry, something went wrong.

Uh oh!

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

All reactions

@EliahKagan EliahKagan Jul 17, 2024

Copy link
Copy Markdown
Member

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 seems like a good approach to me.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread pyproject.toml Resolved

Uh oh!

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

Comment thread test/test_refs.py Resolved

Uh oh!

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

@Borda
Borda force-pushed the precommit/typos branch from 0451fdd to abd9683 Compare May 30, 2024 10:21
This was referenced May 30, 2024
precommit: enable end-of-file-fixer #1920
Merged
precommit: enable validate-pyproject #1921
Merged
Byron
Byron requested changes May 31, 2024
View reviewed changes

@Byron Byron left a comment

Copy link
Copy Markdown
Member

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.

I am now officially setting this PR to a state that indicates that some modifications are needed.

Sorry, something went wrong.

Uh oh!

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

Borda reacted with eyes emoji
All reactions
  • 👀 1 reaction
Borda added 2 commits July 17, 2024 12:17
@Borda
use codespell
1c88b0a
@Borda
fix & skip
2ce013c
@Borda
Borda force-pushed the precommit/typos branch from b1aa63d to 2ce013c Compare July 17, 2024 10:20
@Borda
fixing
93993b2
Borda
Borda commented Jul 17, 2024
View reviewed changes
Comment thread git/remote.py Resolved

Uh oh!

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

@Borda
Apply suggestions from code review
813520c
Borda
Borda commented Jul 17, 2024
View reviewed changes
Comment thread test/test_exc.py
_streams_n_substrings = (
None,
"steram",
"stream",

@Borda Borda Jul 17, 2024

Copy link
Copy Markdown
Contributor 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 probably linked to fixtures / test data

Sorry, something went wrong.

Uh oh!

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

All reactions
@Borda
Borda requested review from Byron and EliahKagan July 17, 2024 10:40
@Borda

Borda commented Jul 17, 2024

Copy link
Copy Markdown
Contributor Author

@EliahKagan @Byron reverted most of my additional changes so keep it just with adding check and fixing all flagged issues, also excluding fixtures...

EliahKagan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

Byron
Byron approved these changes Jul 17, 2024
View reviewed changes

@Byron Byron left a comment

Copy link
Copy Markdown
Member

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.

Thanks a lot for the minification of the PR, it looks good to me!

Sorry, something went wrong.

Uh oh!

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

EliahKagan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Byron
Byron merged commit 89822f8 into gitpython-developers:main Jul 17, 2024
EliahKagan
EliahKagan reviewed Jul 17, 2024
View reviewed changes

@EliahKagan EliahKagan left a comment

Copy link
Copy Markdown
Member

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.

Thanks!

Sorry, something went wrong.

Uh oh!

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

All reactions
@Borda
Borda deleted the precommit/typos branch July 17, 2024 17:30
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Jul 24, 2024
@EliahKagan
Use Alpine Linux in WSL on CI
58a9a58
Some of the CI tests use WSL. This switches the WSL distribution
from Debian to Alpine, which might be slightly faster. For the way
it is being used here, the main expected speed improvement would be
to how long the image would take to download, as Alpine is smaller.

(The reason for this is thus unrelated to the reason for the Alpine
docker CI test job added in gitpython-developers#1826. There, the goal was to test on a
wider variety of systems and environments, and that runs the whole
test suite in Alpine. This just changes the WSL distro, used by a
few tests on Windows, from Debian to Alpine.)

Two things have changed that, taken together, have unblocked this:

- Vampire/setup-wsl#50 was fixed, so the
  action we are using is able to install Alpine Linux. See:
  gitpython-developers#1917 (review)

- gitpython-developers#1893 was fixed in gitpython-developers#1888. So if switching the WSL distro from
  Debian to Alpine breaks any tests, including by making them fail
  in an unexpected way that raises the wrong exception, we are
  likely to find out.
@EliahKagan EliahKagan mentioned this pull request Jul 24, 2024
Use Alpine Linux in WSL on CI #1945
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@EliahKagan EliahKagan EliahKagan requested changes
@Byron Byron Byron approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

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.

3 participants

@Borda @EliahKagan @Byron
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.