Skip to content

Conversation

@enr0n
Copy link
Collaborator

@enr0n enr0n commented Jan 29, 2026

This PR adds the initial structure of the Python module and CLI, and implements some basic lints.

The ubuntu_lint module provides the objects required to implement lints:

  • Context: a class that contains the necessary context of a source package, upload, etc. to implement a lint check.
  • LintFailure: a trivial exception that is raised by lint checks on failure.

and, several lint basic lints:

  • check_missing_ubuntu_maintainer
  • check_missing_launchpad_bugs_fixed
  • check_missing_bug_references
  • check_distribution_invalid
  • check_missing_git_ubuntu_references
  • check_missing_pending_changelog_entry
  • check_sru_bug_missing_template
  • check_sru_bug_missing_release_tasks

More will be added soon.

The ubuntu-lint CLI tool is a basic wrapper around these checks, with flags to control each lint. For now, the output and operation of the CLI is very basic, and will be addressed soon.

enr0n added 25 commits January 29, 2026 12:51
The purpose of this class is to encapsulate context for package source
changes, the source package, etc. required for a linter to operate.

A linter is intended to be a function that accepts a Context, and using
the available information, determines if the check has passed or not. If
it fails, it calls Context.lint_fail with the reason, which raises
LintFailure.

Callers of the linters should handle LintFailure to determine why the
check failed.

For now, the class contains a changes attribute (type debian.deb822.Changes)
to inspect a source changes file, and a debian_changelog attribute
(type debian.changelog.Changelog) to inspect the changelog of a source
package.

More information will be added to this class as needed.
There are no linters defined yet, but this tool adds the scaffolding
required.

The basic structure is around a Runner class, which holds a set of
linters to run, by name. For each linter named foo, there is a command
line argument --foo= which accepts "auto", "warn", "fail", "off", and
defaults to "auto". This enables control over linters.

Additionally, there are flags for context, e.g. --debian-changelog,
--source-dir, and --changes-file.

Output formatting is minimal at this stage.
Inspect a source changes file, and if it's an Ubuntu revision, complain
if the Maintainer field is not set correctly.

This lint should be expanded to check debian/control also.
Inspect a source changes file, and complain if Launchpad-Bugs-Fixed is
not set.

In the CLI, this defaults to a warning for devel, and failure for
stable.
Inspect the changelog entry for bug references, and complain if there
are none.

This is a warning on devel, and a failure on stable.
Ensure that the changelog references a valid distribution.
This is useful to ensure that the changes file has valid references for
git-ubuntu, which are how the importer preserves rich history.

For now this is only a warning in the CLI, but if the context gains
git-ubuntu support, it could be a fail in those contexts.
This will be used for other linters in subsequent commits.
This checks if there is already a version in -proposed, and whether the
changes file included reference to it. On the CLI, this is a warning for
devel, but fail for stable.
This is a simple warning if it does not appear the referenced bugs have
SRU templates.
Warn about release tasks not being set on SRU bugs. Off by default, and
a warning for stable.
Logging in to launchpad for the handle is slow. Do not do it until the
first time context.lp is used.
@enr0n enr0n marked this pull request as ready for review January 29, 2026 18:33
@enr0n enr0n marked this pull request as draft January 29, 2026 18:33
@enr0n enr0n force-pushed the main branch 2 times, most recently from f08ef4c to 1437898 Compare January 29, 2026 18:43
@enr0n enr0n marked this pull request as ready for review January 29, 2026 18:48
@enr0n enr0n marked this pull request as draft January 29, 2026 18:48
@enr0n enr0n changed the title WIP: introduce ubuntu-lint Introduce ubuntu-lint Jan 29, 2026
@enr0n
Copy link
Collaborator Author

enr0n commented Jan 29, 2026

I am not exactly sure why the CI does not run here, but here it is running on my fork: https://github.com/enr0n/ubuntu-lint/actions/runs/21490580966.

@enr0n enr0n marked this pull request as ready for review January 29, 2026 19:02
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.

1 participant