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

pkg: cleanup ruff.toml exceptions #20805

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

jelly
Copy link
Member

@jelly jelly commented Jul 26, 2024

The only tricky leftover is F821 due to the nature of how we use programs with Inotify from pkg/lib/inotify as we concatenate them while spawning.

We can't do


if typing.TYPE_CHECKING:
    from foo import Inotify

Either as inotify is not in sys.path, so that requires more hacks. And this spawning a warning that this is a real import.


Potential bikeshed topic is that the shebang should be dropped from pkg/*.py? I have no strong opinion here.

This requires us to fix two easy violations.
This leaves one exclude which is hard to fix (undefined name F821) due to the
nature how we run python scripts with inotify. We can't import inotify
as we use our own inotify Python library which we concatenate before the
executed script (for example mount-users.py).
@jelly jelly requested a review from martinpitt July 26, 2024 08:45
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks! I would have leaned towards dropping the shebang from the py helpers, but I suppose it's useful to be able to run them on their own for development.

@jelly
Copy link
Member Author

jelly commented Jul 26, 2024

Thanks! I would have leaned towards dropping the shebang from the py helpers, but I suppose it's useful to be able to run them on their own for development.

Yeah, thought about that then realised that isn't doable without pre-pending inotify.py. But mount-users doesn't use inotify for example, so it is locally runnable.

@jelly jelly merged commit a0bbcab into cockpit-project:main Jul 26, 2024
78 of 79 checks passed
@jelly jelly deleted the pkg-restrict-long-lines branch July 26, 2024 15:09
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