-
Notifications
You must be signed in to change notification settings - Fork 2
Add lint rule for "~ppa" in version strings #4
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "description": "check that ppa is not present in the version string for uploads to the archive or vice versa", | ||
| "path": "ubuntu_lint.dput.dput_ppa_version_string", | ||
| "pre": true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "+hooks": [ | ||
| "ppa-version-string" | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ class Context: | |
| def __init__( | ||
| self, | ||
| changes: str | deb822.Changes | None = None, | ||
| profile: dict | None = None, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, I am not sure it makes sense to add this to It would be different than the other checks so far, but I think it might make more sense to write this as a pure hook in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree it doesn't feel great to add this to context for essentially a single hook, but adding this as a pure hook in I would argue enlarging the context object makes more sense than essentially bypassing half your work by adding a pure hook, since the upload target is context and arguably could be used by other hooks, but I'll leave it up to you which way you prefer the implementation.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's go with the pure dput hook for now. It doesn't really feel like it's bypassing anything substantial to me. Also, the dput hooks may ultimately be upstreamed to dput-ng anyways. That's part of why they are separated like this |
||
| debian_changelog: str | changelog.Changelog | None = None, | ||
| launchpad_handle: Launchpad | None = None, | ||
| source_dir: str | None = None, | ||
|
|
@@ -58,6 +59,10 @@ def __init__( | |
| elif changes is not None: | ||
| raise ValueError("invalid type for changes") | ||
|
|
||
| self._profile: dict | None = None | ||
| if profile is not None: | ||
| self._profile = profile | ||
|
|
||
| self._changelog: changelog.Changelog | None = None | ||
| if isinstance(debian_changelog, str): | ||
| with open(debian_changelog, "r") as f: | ||
|
|
@@ -84,6 +89,14 @@ def changes(self) -> deb822.Changes: | |
|
|
||
| return self._changes | ||
|
|
||
| @property | ||
| def profile(self) -> dict: | ||
| if not self._profile: | ||
| raise MissingContextException("missing context for upload profile") | ||
| assert self._profile is not None | ||
|
|
||
| return self._profile | ||
|
|
||
| def changelog_entry_by_index(self, index: int) -> changelog.ChangeBlock: | ||
| if not self._changelog: | ||
| raise MissingContextException("missing context for changelog entry") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.