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

SET-170: move some functions to utility #270

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

Conversation

ckrishk
Copy link

@ckrishk ckrishk commented Sep 29, 2024

Moving function to utility file

Copy link

github-actions bot commented Sep 29, 2024

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 9e72971.

♻️ This comment has been updated with latest results.

@jmarshall
Copy link
Contributor

Test action fails with:

ruff-format..............................................................Failed
- hook id: ruff-format
- files were modified by this hook

3 files reformatted, 40 files left unchanged
[…]
mypy.....................................................................Failed
[…]
cpg_infra/driver.py:71: error: Only concrete class can be given where
"type[CloudInfraBase]" is expected  [type-abstract]
        c.name(): c

I was able to reproduce this locally by setting up pre-commit. Here is what I think is going on here:

The original code on main is

    c.name(): c  # type: ignore
    for c in CloudInfraBase.__subclasses__()

Apparently the types here are too mysterious for mypy, hence the type: ignore annotation.

Your branch has reformatted that onto one line:

    c.name(): c for c in CloudInfraBase.__subclasses__()  # type: ignore

However for whatever reason ruff-format doesn't like that and has reformatted it back again:

    c.name(): c
    for c in CloudInfraBase.__subclasses__()  # type: ignore

Handily the later pre-commit hook apparently sees that uncommitted code rather than what's in your PR! And now the annotation is on the wrong line so is ineffective.

@jmarshall
Copy link
Contributor

I feel like you've got a case of duelling linters and autoformatters here. For example, your PR changes all the '…' strings to "…" — and the pre-commit ruff-format hook is changing them all back again. So both these strings and the formatting of the c.name(): c for c in … line were perhaps altered by something you've got set up locally, and it probably would benefit from being configured to agree more with the linters the code is already formatted for…

@ckrishk
Copy link
Author

ckrishk commented Oct 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants