diff options
author | Tim Harder <radhermit@gmail.com> | 2019-12-05 19:18:41 -0700 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2019-12-05 19:44:18 -0700 |
commit | 266589877f57e46b2bd241eb17bfc28cfef19b2a (patch) | |
tree | 9979ff1b3d35acb6b09ea63788a0eac3a4f2e160 | |
parent | readme: clarify required deps (diff) | |
download | pkgcheck-266589877f57e46b2bd241eb17bfc28cfef19b2a.tar.gz pkgcheck-266589877f57e46b2bd241eb17bfc28cfef19b2a.tar.bz2 pkgcheck-266589877f57e46b2bd241eb17bfc28cfef19b2a.zip |
checks: use f-strings for various string formatting '%' usage
-rw-r--r-- | src/pkgcheck/checks/cleanup.py | 7 | ||||
-rw-r--r-- | src/pkgcheck/checks/eclass.py | 11 | ||||
-rw-r--r-- | src/pkgcheck/checks/git.py | 16 | ||||
-rw-r--r-- | src/pkgcheck/checks/imlate.py | 20 | ||||
-rw-r--r-- | src/pkgcheck/checks/metadata.py | 39 | ||||
-rw-r--r-- | src/pkgcheck/checks/overlays.py | 22 | ||||
-rw-r--r-- | src/pkgcheck/checks/pkgdir.py | 24 | ||||
-rw-r--r-- | src/pkgcheck/checks/profiles.py | 32 | ||||
-rw-r--r-- | src/pkgcheck/checks/repo_metadata.py | 58 | ||||
-rw-r--r-- | src/pkgcheck/checks/stablereq.py | 8 | ||||
-rw-r--r-- | src/pkgcheck/checks/unstable_only.py | 8 | ||||
-rw-r--r-- | tests/data/repos/profiledir/RepoProfilesCheck/ArchesWithoutProfiles/expected | 2 |
12 files changed, 141 insertions, 106 deletions
diff --git a/src/pkgcheck/checks/cleanup.py b/src/pkgcheck/checks/cleanup.py index 62c16034..7e8bc9ad 100644 --- a/src/pkgcheck/checks/cleanup.py +++ b/src/pkgcheck/checks/cleanup.py @@ -1,4 +1,4 @@ -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import base, results, sources from . import Check @@ -14,8 +14,9 @@ class RedundantVersion(results.VersionResult, results.Info): @property def desc(self): - return "slot(%s) keywords are overshadowed by version%s: %s" % ( - self.slot, _pl(self.later_versions), ', '.join(self.later_versions)) + s = pluralism(self.later_versions) + versions = ', '.join(self.later_versions) + return f'slot({self.slot}) keywords are overshadowed by version{s}: {versions}' class RedundantVersionCheck(Check): diff --git a/src/pkgcheck/checks/eclass.py b/src/pkgcheck/checks/eclass.py index a61c85d4..da20c722 100644 --- a/src/pkgcheck/checks/eclass.py +++ b/src/pkgcheck/checks/eclass.py @@ -1,5 +1,5 @@ from snakeoil.mappings import ImmutableDict -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import results from . import Check @@ -22,8 +22,9 @@ class DeprecatedEclass(results.VersionResult, results.Warning): update_path = 'no replacement' eclass_migration.append(f'{old_eclass} ({update_path})') - return "uses deprecated eclass%s: [ %s ]" % ( - _pl(eclass_migration, plural='es'), ', '.join(eclass_migration)) + es = pluralism(eclass_migration, plural='es') + eclasses = ', '.join(eclass_migration) + return f'uses deprecated eclass{es}: [ {eclasses} ]' class DuplicateEclassInherits(results.VersionResult, results.Warning): @@ -42,8 +43,8 @@ class DuplicateEclassInherits(results.VersionResult, results.Warning): @property def desc(self): eclasses = ', '.join(self.eclasses) - plural = _pl(self.eclasses, plural='es') - return f'duplicate inherits for eclass{plural}: {eclasses}' + es = pluralism(self.eclasses, plural='es') + return f'duplicate inherits for eclass{es}: {eclasses}' class EclassCheck(Check): diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py index 1f56b171..20ae1bad 100644 --- a/src/pkgcheck/checks/git.py +++ b/src/pkgcheck/checks/git.py @@ -12,7 +12,7 @@ from pkgcore.exceptions import PkgcoreException from snakeoil.demandload import demand_compile_regexp from snakeoil.klass import jit_attr from snakeoil.osutils import pjoin -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import base, git, results, sources from ..log import logger @@ -95,8 +95,9 @@ class DirectStableKeywords(results.VersionResult, results.Error): @property def desc(self): - return f'directly committed with stable keyword%s: [ %s ]' % ( - _pl(self.keywords), ', '.join(self.keywords)) + s = pluralism(self.keywords) + keywords = ', '.join(self.keywords) + return f'directly committed with stable keyword{s}: [ {keywords} ]' class _DroppedKeywords(results.PackageResult): @@ -111,10 +112,11 @@ class _DroppedKeywords(results.PackageResult): @property def desc(self): + s = pluralism(self.keywords) keywords = ', '.join(self.keywords) return ( f'commit {self.commit} (or later) dropped {self._status} ' - f'keyword{_pl(self.keywords)}: [ {keywords} ]' + f'keyword{s}: [ {keywords} ]' ) @@ -311,11 +313,9 @@ class MissingSignOff(results.CommitResult, results.Error): @property def desc(self): + s = pluralism(self.missing_sign_offs) sign_offs = ', '.join(self.missing_sign_offs) - return ( - f'commit {self.commit}, ' - f'missing sign-off{_pl(self.missing_sign_offs)}: {sign_offs}' - ) + return f'commit {self.commit}, missing sign-off{s}: {sign_offs}' class GitCommitsCheck(GentooRepoCheck, ExplicitlyEnabledCheck): diff --git a/src/pkgcheck/checks/imlate.py b/src/pkgcheck/checks/imlate.py index 96732f46..f06f51ef 100644 --- a/src/pkgcheck/checks/imlate.py +++ b/src/pkgcheck/checks/imlate.py @@ -2,7 +2,7 @@ from collections import defaultdict from itertools import chain from pkgcore.restrictions import packages, values -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import addons, base, results, sources from . import Check @@ -19,9 +19,11 @@ class PotentialStable(results.VersionResult, results.Info): @property def desc(self): - return "slot(%s), stabled arch%s: [ %s ], potential%s: [ %s ]" % ( - self.slot, _pl(self.stable, plural='es'), ', '.join(self.stable), - _pl(self.keywords), ', '.join(self.keywords)) + es = pluralism(self.stable, plural='es') + stable = ', '.join(self.stable) + s = pluralism(self.keywords) + keywords = ', '.join(self.keywords) + return f'slot({self.slot}), stabled arch{es}: [ {stable} ], potential{s}: [ {keywords} ]' class LaggingStable(results.VersionResult, results.Info): @@ -35,9 +37,10 @@ class LaggingStable(results.VersionResult, results.Info): @property def desc(self): - return "slot(%s), stabled arch%s: [ %s ], lagging: [ %s ]" % ( - self.slot, _pl(self.stable, plural='es'), - ', '.join(self.stable), ', '.join(self.keywords)) + es = pluralism(self.stable, plural='es') + stable = ', '.join(self.stable) + keywords = ', '.join(self.keywords) + return f'slot({self.slot}), stabled arch{es}: [ {stable} ], lagging: [ {keywords} ]' class ImlateCheck(Check): @@ -64,8 +67,7 @@ class ImlateCheck(Check): super().__init__(*args) self.all_arches = frozenset(self.options.arches) self.stable_arches = frozenset(arch.strip().lstrip("~") for arch in self.options.stable_arches) - self.target_arches = frozenset( - "~%s" % arch.strip().lstrip("~") for arch in self.stable_arches) + self.target_arches = frozenset(f'~{arch}' for arch in self.stable_arches) source_arches = self.options.source_arches if source_arches is None: diff --git a/src/pkgcheck/checks/metadata.py b/src/pkgcheck/checks/metadata.py index 4b6a54c5..4fb00886 100644 --- a/src/pkgcheck/checks/metadata.py +++ b/src/pkgcheck/checks/metadata.py @@ -16,7 +16,7 @@ from pkgcore.restrictions import packages, values, boolean from snakeoil.klass import jit_attr from snakeoil.mappings import ImmutableDict from snakeoil.sequences import iflatten_instance -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import addons, base, git, results, sources from ..addons import UnstatedIuse @@ -33,8 +33,9 @@ class MissingLicenseFile(results.VersionResult, results.Error): @property def desc(self): + s = pluralism(self.licenses) licenses = ', '.join(self.licenses) - return f"no matching license file{_pl(self.licenses)}: {licenses}" + return f'no matching license file{s}: {licenses}' class MissingLicense(results.VersionResult, results.Error): @@ -159,8 +160,9 @@ class _UseFlagsResult(results.VersionResult, results.Error): @property def desc(self): + s = pluralism(self.flags) flags = ', '.join(map(repr, sorted(self.flags))) - return f'{self._type} USE flag{_pl(self.flags)}: {flags}' + return f'{self._type} USE flag{s}: {flags}' class InvalidUseFlags(_UseFlagsResult): @@ -370,8 +372,9 @@ class UnusedLocalUse(results.PackageResult, results.Warning): @property def desc(self): - return "metadata.xml unused local USE flag%s: [ %s ]" % ( - _pl(self.flags), ', '.join(self.flags)) + s = pluralism(self.flags) + flags = ', '.join(self.flags) + return f'metadata.xml unused local USE flag{s}: [ {flags} ]' class MatchingGlobalUse(results.PackageResult, results.Error): @@ -578,9 +581,11 @@ class MissingUseDepDefault(results.VersionResult, results.Warning): @property def desc(self): + s = pluralism(self.pkgs) + pkgs = ', '.join(self.pkgs) return ( f'{self.attr}="{self.atom}": USE flag {self.flag!r} missing from ' - f"package{_pl(self.pkgs)}: [ {', '.join(self.pkgs)} ]" + f'package{s}: [ {pkgs} ]' ) @@ -956,8 +961,9 @@ class MissingUri(results.VersionResult, results.Warning): @property def desc(self): + s = pluralism(self.filenames) filenames = ', '.join(map(repr, self.filenames)) - return f'unfetchable file{_pl(self.filenames)}: {filenames}' + return f'unfetchable file{s}: {filenames}' class UnknownMirror(results.VersionResult, results.Error): @@ -986,8 +992,9 @@ class BadProtocol(results.VersionResult, results.Error): @property def desc(self): + s = pluralism(self.uris) uris = ', '.join(map(repr, self.uris)) - return f'bad protocol {self.protocol!r} in URI{_pl(self.uris)}: {uris}' + return f'bad protocol {self.protocol!r} in URI{s}: {uris}' class BadFilename(results.VersionResult, results.Warning): @@ -1002,8 +1009,9 @@ class BadFilename(results.VersionResult, results.Warning): @property def desc(self): + s = pluralism(self.filenames) filenames = ', '.join(self.filenames) - return f'bad filename{_pl(self.filenames)}: [ {filenames} ]' + return f'bad filename{s}: [ {filenames} ]' class TarballAvailable(results.VersionResult, results.Warning): @@ -1019,8 +1027,9 @@ class TarballAvailable(results.VersionResult, results.Warning): @property def desc(self): - return (f"zip archive{_pl(self.uris)} used when tarball available: " - f"[ {' '.join(self.uris)} ]") + s = pluralism(self.uris) + uris = ' '.join(self.uris) + return f'zip archive{s} used when tarball available: [ {uris} ]' class InvalidSrcUri(results.MetadataError): @@ -1345,11 +1354,9 @@ class MissingUnpackerDep(results.VersionResult, results.Warning): else: dep = f"|| ( {' '.join(self.unpackers)} )" - return ( - f'missing {dep_type}="{dep}" ' - f"for SRC_URI archive{_pl(self.filenames)}: " - f"[ {', '.join(self.filenames)} ]" - ) + s = pluralism(self.filenames) + filenames = ', '.join(self.filenames) + return f'missing {dep_type}="{dep}" for SRC_URI archive{s}: [ {filenames} ]' class MissingUnpackerDepCheck(Check): diff --git a/src/pkgcheck/checks/overlays.py b/src/pkgcheck/checks/overlays.py index 2ffb0e02..97ba99b7 100644 --- a/src/pkgcheck/checks/overlays.py +++ b/src/pkgcheck/checks/overlays.py @@ -1,5 +1,5 @@ from snakeoil.sequences import iflatten_instance -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import base, results, sources from . import ExplicitlyEnabledCheck, OverlayRepoCheck, repo_metadata @@ -17,8 +17,9 @@ class UnusedInMastersLicenses(results.VersionResult, results.Warning): @property def desc(self): - return "unused license%s in master repo(s): %s" % ( - _pl(self.licenses), ', '.join(self.licenses)) + s = pluralism(self.licenses) + licenses = ', '.join(self.licenses) + return f'unused license{s} in master repo(s): {licenses}' class UnusedInMastersMirrors(results.VersionResult, results.Warning): @@ -33,8 +34,9 @@ class UnusedInMastersMirrors(results.VersionResult, results.Warning): @property def desc(self): - return "unused mirror%s in master repo(s): %s" % ( - _pl(self.mirrors), ', '.join(self.mirrors)) + s = pluralism(self.mirrors) + mirrors = ', '.join(self.mirrors) + return f'unused mirror{s} in master repo(s): {mirrors}' class UnusedInMastersEclasses(results.VersionResult, results.Warning): @@ -49,8 +51,9 @@ class UnusedInMastersEclasses(results.VersionResult, results.Warning): @property def desc(self): - return "unused eclass%s in master repo(s): %s" % ( - _pl(self.eclasses, plural='es'), ', '.join(self.eclasses)) + es = pluralism(self.eclasses, plural='es') + eclasses = ', '.join(self.eclasses) + return f'unused eclass{es} in master repo(s): {eclasses}' class UnusedInMastersGlobalUse(results.VersionResult, results.Warning): @@ -65,8 +68,9 @@ class UnusedInMastersGlobalUse(results.VersionResult, results.Warning): @property def desc(self): - return "use.desc unused flag%s in master repo(s): %s" % ( - _pl(self.flags), ', '.join(self.flags)) + s = pluralism(self.flags) + flags = ', '.join(self.flags) + return f'use.desc unused flag{s} in master repo(s): {flags}' class UnusedInMastersCheck(repo_metadata._MirrorsCheck, diff --git a/src/pkgcheck/checks/pkgdir.py b/src/pkgcheck/checks/pkgdir.py index 383d64ad..a7760167 100644 --- a/src/pkgcheck/checks/pkgdir.py +++ b/src/pkgcheck/checks/pkgdir.py @@ -6,7 +6,7 @@ from pkgcore.ebuild.atom import MalformedAtom from pkgcore.ebuild.atom import atom as atom_cls from snakeoil.chksum import get_chksums from snakeoil.osutils import listdir, pjoin, sizeof_fmt -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import base, git, results, sources from . import Check @@ -28,8 +28,9 @@ class MismatchedPN(results.PackageResult, results.Error): @property def desc(self): - return "mismatched package name%s: [ %s ]" % ( - _pl(self.ebuilds), ', '.join(self.ebuilds)) + s = pluralism(self.ebuilds) + ebuilds = ', '.join(self.ebuilds) + return f'mismatched package name{s}: [ {ebuilds} ]' class InvalidPN(results.PackageResult, results.Error): @@ -41,8 +42,9 @@ class InvalidPN(results.PackageResult, results.Error): @property def desc(self): - return "invalid package name%s: [ %s ]" % ( - _pl(self.ebuilds), ', '.join(self.ebuilds)) + s = pluralism(self.ebuilds) + ebuilds = ', '.join(self.ebuilds) + return f'invalid package name{s}: [ {ebuilds} ]' class EqualVersions(results.PackageResult, results.Error): @@ -71,8 +73,8 @@ class DuplicateFiles(results.PackageResult, results.Warning): @property def desc(self): - return 'duplicate identical files in FILESDIR: %s' % ( - ', '.join(map(repr, self.files))) + files = ', '.join(map(repr, self.files)) + return f'duplicate identical files in FILESDIR: {files}' class EmptyFile(results.PackageResult, results.Warning): @@ -113,7 +115,7 @@ class UnknownPkgDirEntry(results.PackageResult, results.Warning): @property def desc(self): files = ', '.join(map(repr, self.filenames)) - y = _pl(self.filenames, singular='y', plural='ies') + y = pluralism(self.filenames, singular='y', plural='ies') return f'unknown entr{y}: {files}' @@ -145,11 +147,9 @@ class BannedCharacter(results.PackageResult, results.Error): @property def desc(self): + s = pluralism(self.chars) chars = ', '.join(map(repr, self.chars)) - return ( - f'filename {self.filename!r} character{_pl(self.chars)} ' - f'outside allowed set: {chars}' - ) + return f'filename {self.filename!r} character{s} outside allowed set: {chars}' class InvalidUTF8(results.PackageResult, results.Error): diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py index ceaea054..f216cef5 100644 --- a/src/pkgcheck/checks/profiles.py +++ b/src/pkgcheck/checks/profiles.py @@ -9,7 +9,7 @@ from snakeoil.contexts import patch from snakeoil.klass import jit_attr from snakeoil.osutils import listdir_dirs, pjoin from snakeoil.sequences import iflatten_instance -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import addons, base, results, sources from . import Check @@ -25,8 +25,9 @@ class UnknownProfilePackages(results.Warning): @property def desc(self): - return "%r: unknown package%s: [ %s ]" % ( - self.path, _pl(self.packages), ', '.join(map(repr, self.packages))) + s = pluralism(self.packages) + packages = ', '.join(map(repr, self.packages)) + return f'{self.path!r}: unknown package{s}: [ {packages} ]' class UnknownProfilePackageUse(results.Warning): @@ -40,9 +41,9 @@ class UnknownProfilePackageUse(results.Warning): @property def desc(self): - return "%r: unknown package USE flag%s: [ '%s[%s]' ]" % ( - self.path, _pl(self.flags), self.package, - ','.join(self.flags)) + s = pluralism(self.flags) + flags = ', '.join(self.flags) + return f'{self.path!r}: unknown package USE flag{s}: [ {self.package}[{flags}] ]' class UnknownProfileUse(results.Warning): @@ -55,8 +56,9 @@ class UnknownProfileUse(results.Warning): @property def desc(self): - return "%r: unknown USE flag%s: [ %s ]" % ( - self.path, _pl(self.flags), ', '.join(map(repr, self.flags))) + s = pluralism(self.flags) + flags = ', '.join(map(repr, self.flags)) + return f'{self.path!r}: unknown USE flag{s}: [ {flags} ]' class UnknownProfilePackageKeywords(results.Warning): @@ -70,9 +72,9 @@ class UnknownProfilePackageKeywords(results.Warning): @property def desc(self): - return "%r: unknown package keyword%s: %s: [ %s ]" % ( - self.path, _pl(self.keywords), self.package, - ', '.join(map(repr, self.keywords))) + s = pluralism(self.keywords) + keywords = ', '.join(map(repr, self.keywords)) + return f'{self.path!r}: unknown package keyword{s}: {self.package}: [ {keywords} ]' class ProfileWarning(results.LogWarning): @@ -263,8 +265,9 @@ class UnusedProfileDirs(results.Warning): @property def desc(self): + s = pluralism(self.dirs) dirs = ', '.join(map(repr, self.dirs)) - return f'unused profile dir{_pl(self.dirs)}: {dirs}' + return f'unused profile dir{s}: {dirs}' class ArchesWithoutProfiles(results.Warning): @@ -276,8 +279,9 @@ class ArchesWithoutProfiles(results.Warning): @property def desc(self): + es = pluralism(self.arches, plural='es') arches = ', '.join(self.arches) - return f"arch{_pl(self.arches, plural='es')} without profile: {arches}" + return f'arch{es} without profiles: {arches}' class NonexistentProfilePath(results.Error): @@ -323,7 +327,7 @@ class UnknownCategories(results.Warning): @property def desc(self): categories = ', '.join(self.categories) - y = _pl(self.categories, singular='y', plural='ies') + y = pluralism(self.categories, singular='y', plural='ies') return f'unknown categor{y}: {categories}' diff --git a/src/pkgcheck/checks/repo_metadata.py b/src/pkgcheck/checks/repo_metadata.py index 0a9f42e2..c1fadbcb 100644 --- a/src/pkgcheck/checks/repo_metadata.py +++ b/src/pkgcheck/checks/repo_metadata.py @@ -6,7 +6,7 @@ from pkgcore import fetch from snakeoil.contexts import patch from snakeoil.klass import jit_attr from snakeoil.sequences import iflatten_instance -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import addons, base, results, sources from . import Check @@ -144,8 +144,9 @@ class UnusedLicenses(results.Warning): @property def desc(self): + s = pluralism(self.licenses) licenses = ', '.join(self.licenses) - return f'unused license{_pl(self.licenses)}: {licenses}' + return f'unused license{s}: {licenses}' class UnusedLicensesCheck(Check): @@ -182,8 +183,9 @@ class UnusedMirrors(results.Warning): @property def desc(self): + s = pluralism(self.mirrors) mirrors = ', '.join(self.mirrors) - return f'unused mirror{_pl(self.mirrors)}: {mirrors}' + return f'unused mirror{s}: {mirrors}' class _MirrorsCheck(Check): @@ -238,8 +240,9 @@ class UnusedEclasses(results.Warning): @property def desc(self): + es = pluralism(self.eclasses, plural='es') eclasses = ', '.join(self.eclasses) - return f"unused eclass{_pl(self.eclasses, plural='es')}: {eclasses}" + return f'unused eclass{es}: {eclasses}' class UnusedEclassesCheck(Check): @@ -278,8 +281,9 @@ class UnknownLicenses(results.Warning): @property def desc(self): - return "license group %r has unknown license%s: [ %s ]" % ( - self.group, _pl(self.licenses), ', '.join(self.licenses)) + s = pluralism(self.licenses) + licenses = ', '.join(self.licenses) + return f'license group {self.group!r} has unknown license{s}: [ {licenses} ]' class LicenseGroupsCheck(Check): @@ -310,9 +314,12 @@ class PotentialLocalUse(results.Info): @property def desc(self): + s = pluralism(self.pkgs) + pkgs = ', '.join(self.pkgs) return ( - f"global USE flag {self.flag!r} is a potential local, " - f"used by {len(self.pkgs)} package{_pl(len(self.pkgs))}: {', '.join(self.pkgs)}") + f'global USE flag {self.flag!r} is a potential local, ' + f'used by {len(self.pkgs)} package{s}: {pkgs}' + ) class UnusedGlobalUse(results.Warning): @@ -324,8 +331,9 @@ class UnusedGlobalUse(results.Warning): @property def desc(self): - return "use.desc unused flag%s: %s" % ( - _pl(self.flags), ', '.join(self.flags)) + s = pluralism(self.flags) + flags = ', '.join(self.flags) + return f'use.desc unused flag{s}: {flags}' class PotentialGlobalUse(results.Info): @@ -484,10 +492,9 @@ class DeprecatedChksum(results.VersionResult, results.Warning): @property def desc(self): - return ( - f"{self.filename!r} has deprecated checksum{_pl(self.deprecated)}: " - f"{', '.join(self.deprecated)}" - ) + s = pluralism(self.deprecated) + deprecated = ', '.join(self.deprecated) + return f'{self.filename!r} has deprecated checksum{s}: {deprecated}' class MissingManifest(results.VersionResult, results.Error): @@ -499,8 +506,9 @@ class MissingManifest(results.VersionResult, results.Error): @property def desc(self): - return "distfile%s missing from Manifest: [ %s ]" % ( - _pl(self.files), ', '.join(self.files),) + s = pluralism(self.files) + files = ', '.join(self.files) + return f'distfile{s} missing from Manifest: [ {files} ]' class UnknownManifest(results.PackageResult, results.Warning): @@ -512,8 +520,9 @@ class UnknownManifest(results.PackageResult, results.Warning): @property def desc(self): - return "unknown distfile%s in Manifest: [ %s ]" % ( - _pl(self.files), ', '.join(self.files),) + s = pluralism(self.files) + files = ', '.join(self.files) + return f'unknown distfile{s} in Manifest: [ {files} ]' class UnnecessaryManifest(results.PackageResult, results.Warning): @@ -525,8 +534,9 @@ class UnnecessaryManifest(results.PackageResult, results.Warning): @property def desc(self): - return "unnecessary file%s in Manifest: [ %s ]" % ( - _pl(self.files), ', '.join(self.files),) + s = pluralism(self.files) + files = ', '.join(self.files) + return f'unnecessary file{s} in Manifest: [ {files} ]' class ManifestCheck(Check): @@ -607,11 +617,13 @@ class ConflictingChksums(results.VersionResult, results.Error): @property def desc(self): - pkgs = ', '.join(self.pkgs) + s = pluralism(self.chksums) chksums = ', '.join(self.chksums) + pkgs_s = pluralism(self.pkgs) + pkgs = ', '.join(self.pkgs) return ( - f'distfile {self.filename!r} has different checksum{_pl(self.chksums)} ' - f'({chksums}) for package{_pl(self.pkgs)}: {pkgs}' + f'distfile {self.filename!r} has different checksum{s} ' + f'({chksums}) for package{pkgs_s}: {pkgs}' ) diff --git a/src/pkgcheck/checks/stablereq.py b/src/pkgcheck/checks/stablereq.py index 4dfa54fa..58227fc1 100644 --- a/src/pkgcheck/checks/stablereq.py +++ b/src/pkgcheck/checks/stablereq.py @@ -3,7 +3,7 @@ from datetime import datetime from itertools import chain from snakeoil.klass import jit_attr -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import base, git, results, sources from . import GentooRepoCheck @@ -22,9 +22,11 @@ class StableRequest(results.VersionResult, results.Info): @property def desc(self): + s = pluralism(self.keywords) + keywords = ', '.join(self.keywords) return ( - f"slot({self.slot}) no change in {self.age} days for unstable " - "keyword%s: [ %s ]" % (_pl(self.keywords), ', '.join(self.keywords)) + f"slot({self.slot}) no change in {self.age} days " + f"for unstable keyword{s}: [ {keywords} ]" ) diff --git a/src/pkgcheck/checks/unstable_only.py b/src/pkgcheck/checks/unstable_only.py index 94fc9689..11e978f7 100644 --- a/src/pkgcheck/checks/unstable_only.py +++ b/src/pkgcheck/checks/unstable_only.py @@ -2,7 +2,7 @@ from collections import defaultdict from pkgcore.ebuild.misc import sort_keywords from pkgcore.restrictions import packages, values -from snakeoil.strings import pluralism as _pl +from snakeoil.strings import pluralism from .. import addons, base, results, sources from . import GentooRepoCheck @@ -18,8 +18,10 @@ class UnstableOnly(results.PackageResult, results.Info): @property def desc(self): - return "for arch%s: [ %s ], all versions are unstable: [ %s ]" % ( - _pl(self.arches, plural='es'), ', '.join(self.arches), ', '.join(self.versions)) + es = pluralism(self.arches, plural='es') + arches = ', '.join(self.arches) + versions = ', '.join(self.versions) + return f'for arch{es}: [ {arches} ], all versions are unstable: [ {versions} ]' class UnstableOnlyCheck(GentooRepoCheck): diff --git a/tests/data/repos/profiledir/RepoProfilesCheck/ArchesWithoutProfiles/expected b/tests/data/repos/profiledir/RepoProfilesCheck/ArchesWithoutProfiles/expected index 1ef0289b..4890ce33 100644 --- a/tests/data/repos/profiledir/RepoProfilesCheck/ArchesWithoutProfiles/expected +++ b/tests/data/repos/profiledir/RepoProfilesCheck/ArchesWithoutProfiles/expected @@ -1,2 +1,2 @@ repo - ArchesWithoutProfiles: arch without profile: unknown_arch + ArchesWithoutProfiles: arch without profiles: unknown_arch |