Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements-lint.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mypy==1.14.1
ruff==0.8.6
ruff==0.9.1
9 changes: 4 additions & 5 deletions securesystemslib/_gpg/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,9 @@ def _assign_certified_key_info(bundle):

if not is_valid:
log.info(
"Ignoring invalid User ID self-certificate issued "
"by '{}'.".format(signature["keyid"])
"Ignoring invalid User ID self-certificate issued by '{}'.".format(
signature["keyid"]
)
)
continue

Expand Down Expand Up @@ -752,11 +753,9 @@ def parse_signature_packet(
hashed_subpackets = data[ptr : ptr + hashed_octet_count]
hashed_subpacket_info = gpg_util.parse_subpackets(hashed_subpackets)

# Check whether we were actually able to read this much hashed octets
if len(hashed_subpackets) != hashed_octet_count: # pragma: no cover
raise ValueError(
"This signature packet seems to be corrupted."
"It is missing hashed octets!"
"Signature packet contains an unexpected amount of hashed octets"
)

ptr += hashed_octet_count
Expand Down
3 changes: 1 addition & 2 deletions securesystemslib/_gpg/eddsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def get_pubkey_params(data):
# See 9.2. ECC Curve OID
if curve_oid != ED25519_PUBLIC_KEY_OID:
raise PacketParsingError(
f"bad ed25519 curve OID '{curve_oid}', "
f"expected {ED25519_PUBLIC_KEY_OID}'"
f"bad ed25519 curve OID '{curve_oid}', expected {ED25519_PUBLIC_KEY_OID}'"
)

# See 13.3. EdDSA Point Format
Expand Down
2 changes: 1 addition & 1 deletion securesystemslib/_gpg/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def parse_packet_header(data, expected_type=None): # noqa: PLR0912

elif length_type == 3:
raise PacketParsingError(
"Old length " "format packets of indeterminate length are not supported"
"Old length format packets of indeterminate length are not supported"
)

else: # pragma: no cover (unreachable)
Expand Down
6 changes: 3 additions & 3 deletions tests/check_public_interfaces_gpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
class TestPublicInterfacesGPG(unittest.TestCase):
@classmethod
def setUpClass(cls):
assert (
not have_gpg()
), "please remove GnuPG from your environment to run this test case"
assert not have_gpg(), (
"please remove GnuPG from your environment to run this test case"
)

def test_gpg_functions(self):
"""Signing, key export and util functions must raise on missing gpg."""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def test_verify_signature_with_expired_key(self):
)
self.assertTrue(
expected == str(ctx.exception),
f"\nexpected: {expected}" "\ngot: {ctx.exception}",
f"\nexpected: {expected}\ngot: {{ctx.exception}}",
)


Expand Down
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ commands =

mypy {[testenv:lint]lint_dirs}

[testenv:fix]
deps = {[testenv:lint]deps}
commands =
ruff check --fix {[testenv:lint]lint_dirs}
ruff format {[testenv:lint]lint_dirs}

# Requires docker running
[testenv:local-aws-kms]
deps =
Expand Down