hauntsaninja / mypy_primer

Run mypy and pyright over millions of lines of code
MIT License
57 stars 30 forks source link

Unexpected result when downstream fork is behind master #21

Closed tushar-deepsource closed 2 years ago

tushar-deepsource commented 2 years ago

So I recently found out that if your downstream fork of mypy is behind upstream's master, the mypy_primer report in GitHub CI is going to show unexpected results.

This is because even though the "files changed" section in GitHub's PR shows a small difference between the two branches, mypy_primer sees very different code, causing unrelated diffs.

Is it possible to add an option in mypy_primer to merge upstream's master into the code, to avoid this?

Akuli commented 2 years ago

What should mypy_primer do when there is a merge conflict? Just fail, since eventually the merge conflict must be fixed anyway?

Another alternative would be to not run it against the latest master, but instead whatever master's commit the PR is based on. This way you can always see mypy_primer output, even if you don't want to resolve the merge conflict yet for whatever reason.

tusharsadhwani commented 2 years ago

Personally, just failing sounds like a better idea to me. It's simple and it makes sense.

If there is a merge conflict that means that you have touched some code that's already in master, potentially the same thing that you're working on, so it'd be valuable to wait for it to get fixed.

hauntsaninja commented 2 years ago

Thanks for the report! I opted to just go with using the merge base in https://github.com/python/mypy/pull/11627 (easy to implement and understand, always give PR author feedback, complicated relationships between PRs not captured by unit tests are very rare for mypy)

JelleZijlstra commented 2 years ago

I merged the mypy PR.