Skip to content

flatpak-coredumpctl: Add type hints and refactor code to prepare for future PRs - #6677

Merged
swick merged 5 commits into
flatpak:mainfrom
electricbrass:coredumpctl-type-hints
Jun 23, 2026
Merged

swick merged 5 commits into
flatpak:mainfrom
electricbrass:coredumpctl-type-hints

Conversation

@electricbrass

@electricbrass electricbrass commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

This PR refactors flatpak-coredumpctl to have clearer control flow and slightly more consistent help messages, with type hints added throughout for better static analysis. This is all largely to make future work on it easier and less error-prone.

@bbhtt

bbhtt commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Would have been nice to make the new subcommand a separate PR after the refactorings were done.

Comment thread .gitignore Outdated
Comment thread scripts/flatpak-coredumpctl Outdated
Comment thread scripts/flatpak-coredumpctl Outdated
Comment thread scripts/flatpak-coredumpctl Outdated
Comment thread scripts/flatpak-coredumpctl Outdated
Comment thread scripts/flatpak-coredumpctl
Comment thread scripts/flatpak-coredumpctl
@bbhtt

bbhtt commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

the flatpak-coredumpctl: Add 'flatpak-coredumpctl list' command commit is touching a lot of things such as reorganising argparse that is making hard to review,

@electricbrass
electricbrass force-pushed the coredumpctl-type-hints branch from 52bb50e to 55d8451 Compare June 11, 2026 08:52
@electricbrass

electricbrass commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Would have been nice to make the new subcommand a separate PR after the refactorings were done.

I can split it up into two if you prefer. I was originally going to do that, but then felt like the earlier refactoring didn't have much justification on its own when not paired with the new features.

@electricbrass
electricbrass force-pushed the coredumpctl-type-hints branch 2 times, most recently from 1966b39 to 0d1fdfd Compare June 11, 2026 09:42
@electricbrass

Copy link
Copy Markdown
Contributor Author

the flatpak-coredumpctl: Add 'flatpak-coredumpctl list' command commit is touching a lot of things such as reorganising argparse that is making hard to review,

I can try and split it up some. It definitely felt like a very large commit to me while I was doing it, but I was having a hard time of thinking of how to reasonably make smaller commits.

@bbhtt

bbhtt commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Yes feel free to split this.

-m with no argument currently results in coredumpctl_matches having a
value of "", which is exactly the same as if it weren't used at all. As
far as I can tell, allowing this does nothing useful, only making the
usage slightly less clear.
There are a couple related changes made here, with the intention of
making it easier to implement additional features in the future:
- Mutual exclusivity of --build-directory and app is better enforced
  both through types and at runtime. The types will let type checkers
  ensure that we cannot reach the run function without at least one of
  them being valid. At runtime, it no longer allows both to be
  specified, which could result in confusion over which takes
  precedence.
- Instead of wrapping the entire program in a class, there is now only a
  small class that handles validation of the arguments and holding the
  data to be passed to run. This provides a better separation of
  concerns, with the argument parsing now being a little less tied to
  running the debugger.
Help messages were inconsistent about whether they ended with periods or
not. I chose to remove the periods from those that had them rather than
the other way around because the help messages automatically generated
by argparse do not have periods.
This just makes the generated messages slightly less redundant and a
little closer to coredumpctl's.
@electricbrass
electricbrass force-pushed the coredumpctl-type-hints branch from 0d1fdfd to e71cbb8 Compare June 16, 2026 21:15
@electricbrass

Copy link
Copy Markdown
Contributor Author

Alright, I've made this PR contain only the refactoring and other minor changes. The list subcommand will be in a new PR.

@electricbrass electricbrass changed the title flatpak-coredumpctl: Add flatpak-coredumpctl list subcommand flatpak-coredumpctl: Add type hints and refactor code to prepare for future PRs Jun 16, 2026
@swick
swick added this pull request to the merge queue Jun 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@swick
swick added this pull request to the merge queue Jun 23, 2026
Merged via the queue into flatpak:main with commit a9215f4 Jun 23, 2026
11 checks passed
@electricbrass
electricbrass deleted the coredumpctl-type-hints branch June 23, 2026 09:14
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.

3 participants