ruff: do not warn about too long line and lambda assignment

This commit is contained in:
Yu Watanabe
2026-05-18 02:32:42 +09:00
parent c54decc406
commit 75f7304512
4 changed files with 19 additions and 14 deletions
+6 -1
View File
@@ -1,6 +1,11 @@
target-version = "py39" target-version = "py39"
line-length = 109 line-length = 109
lint.select = ["E", "F", "I", "Q", "UP"]
[lint]
select = ["E", "F", "I", "Q", "UP"]
# E501: line-too-long
# E731: lambda-assignment
ignore = ["E501", "E731"]
[format] [format]
# The formatter prefers double quotes for multiline quotes, # The formatter prefers double quotes for multiline quotes,
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
# #
# ruff: noqa: E501 UP015 # ruff: noqa: UP015
import os import os
import re import re
+10 -10
View File
@@ -1109,7 +1109,7 @@ def pe_add_sections(opts: UkifyConfig, uki: UKI, output: str) -> None:
encoded = json.dumps(j).encode() encoded = json.dumps(j).encode()
if len(encoded) > section.SizeOfRawData: if len(encoded) > section.SizeOfRawData:
raise PEError( raise PEError(
f'Not enough space in existing section .pcrsig of size {section.SizeOfRawData} to append new data of size {len(encoded)}' # noqa: E501 f'Not enough space in existing section .pcrsig of size {section.SizeOfRawData} to append new data of size {len(encoded)}'
) )
section.Misc_VirtualSize = len(encoded) section.Misc_VirtualSize = len(encoded)
# bytes(n) results in an array of n zeroes # bytes(n) results in an array of n zeroes
@@ -1498,7 +1498,7 @@ def make_uki(opts: UkifyConfig) -> None:
if names[0] != '.profile': if names[0] != '.profile':
raise ValueError( raise ValueError(
f'Expected .profile section as first valid section in PE profile binary {profile} but got {names[0]}' # noqa: E501 f'Expected .profile section as first valid section in PE profile binary {profile} but got {names[0]}'
) )
if names.count('.profile') > 1: if names.count('.profile') > 1:
@@ -1688,7 +1688,7 @@ def generate_keys(opts: UkifyConfig) -> None:
if not work: if not work:
raise ValueError( raise ValueError(
'genkey: --secureboot-private-key=/--secureboot-certificate= or --pcr-private-key/--pcr-public-key must be specified' # noqa: E501 'genkey: --secureboot-private-key=/--secureboot-certificate= or --pcr-private-key/--pcr-public-key must be specified'
) )
@@ -1879,7 +1879,7 @@ class ConfigItem:
elif self.type: elif self.type:
conv = self.type conv = self.type
else: else:
conv = lambda s: s # noqa: E731 conv = lambda s: s
# This is a bit ugly, but --initrd and --devicetree-auto are the only options # This is a bit ugly, but --initrd and --devicetree-auto are the only options
# with multiple args on the command line and a space-separated list in the # with multiple args on the command line and a space-separated list in the
@@ -2116,14 +2116,14 @@ CONFIG_ITEMS = [
ConfigItem( ConfigItem(
'--secureboot-private-key', '--secureboot-private-key',
dest='sb_key', dest='sb_key',
help='required by --signtool=sbsign|systemd-sbsign. Path to key file or engine/provider designation for SB signing', # noqa: E501 help='required by --signtool=sbsign|systemd-sbsign. Path to key file or engine/provider designation for SB signing',
config_key='UKI/SecureBootPrivateKey', config_key='UKI/SecureBootPrivateKey',
), ),
ConfigItem( ConfigItem(
'--secureboot-certificate', '--secureboot-certificate',
dest='sb_cert', dest='sb_cert',
help=( help=(
'required by --signtool=sbsign. sbsign needs a path to certificate file or engine-specific designation for SB signing' # noqa: E501 'required by --signtool=sbsign. sbsign needs a path to certificate file or engine-specific designation for SB signing'
), ),
config_key='UKI/SecureBootCertificate', config_key='UKI/SecureBootCertificate',
), ),
@@ -2132,7 +2132,7 @@ CONFIG_ITEMS = [
dest='sb_certdir', dest='sb_certdir',
default='/etc/pki/pesign', default='/etc/pki/pesign',
help=( help=(
'required by --signtool=pesign. Path to nss certificate database directory for PE signing. Default is /etc/pki/pesign' # noqa: E501 'required by --signtool=pesign. Path to nss certificate database directory for PE signing. Default is /etc/pki/pesign'
), ),
config_key='UKI/SecureBootCertificateDir', config_key='UKI/SecureBootCertificateDir',
config_push=ConfigItem.config_set, config_push=ConfigItem.config_set,
@@ -2141,7 +2141,7 @@ CONFIG_ITEMS = [
'--secureboot-certificate-name', '--secureboot-certificate-name',
dest='sb_cert_name', dest='sb_cert_name',
help=( help=(
'required by --signtool=pesign. pesign needs a certificate nickname of nss certificate database entry to use for PE signing' # noqa: E501 'required by --signtool=pesign. pesign needs a certificate nickname of nss certificate database entry to use for PE signing'
), ),
config_key='UKI/SecureBootCertificateName', config_key='UKI/SecureBootCertificateName',
), ),
@@ -2458,7 +2458,7 @@ def finalize_options(opts: argparse.Namespace) -> None:
# both param given, infer sbsign and in case it was given, ensure signtool=sbsign # both param given, infer sbsign and in case it was given, ensure signtool=sbsign
if opts.signtool and opts.signtool not in ('sbsign', 'systemd-sbsign'): if opts.signtool and opts.signtool not in ('sbsign', 'systemd-sbsign'):
raise ValueError( raise ValueError(
f'Cannot provide --signtool={opts.signtool} with --secureboot-private-key= and --secureboot-certificate=' # noqa: E501 f'Cannot provide --signtool={opts.signtool} with --secureboot-private-key= and --secureboot-certificate='
) )
if not opts.signtool: if not opts.signtool:
opts.signtool = 'sbsign' opts.signtool = 'sbsign'
@@ -2478,7 +2478,7 @@ def finalize_options(opts: argparse.Namespace) -> None:
if opts.sign_kernel and not opts.sb_key and not opts.sb_cert_name: if opts.sign_kernel and not opts.sb_key and not opts.sb_cert_name:
raise ValueError( raise ValueError(
'--sign-kernel requires either --secureboot-private-key= and --secureboot-certificate= (for sbsign) or --secureboot-certificate-name= (for pesign) to be specified' # noqa: E501 '--sign-kernel requires either --secureboot-private-key= and --secureboot-certificate= (for sbsign) or --secureboot-certificate-name= (for pesign) to be specified'
) )
opts.profile = resolve_at_path(opts.profile) opts.profile = resolve_at_path(opts.profile)
@@ -589,7 +589,7 @@ def main() -> None:
*(['--forward-journal', journal_file] if journal_file else []), *(['--forward-journal', journal_file] if journal_file else []),
*( *(
[ [
'--credential', f'systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}', # noqa: E501 '--credential', f'systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}',
'--credential', f'systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}', '--credential', f'systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}',
] ]
if not sys.stdin.isatty() if not sys.stdin.isatty()
@@ -700,7 +700,7 @@ def main() -> None:
iter = os.environ['GITHUB_RUN_ATTEMPT'] iter = os.environ['GITHUB_RUN_ATTEMPT']
runner = os.environ['TEST_RUNNER'] runner = os.environ['TEST_RUNNER']
artifact = ( artifact = (
f'ci-{wf}-{id}-{iter}-{summary.distribution}-{summary.release}-{runner}-failed-test-journals' # noqa: E501 f'ci-{wf}-{id}-{iter}-{summary.distribution}-{summary.release}-{runner}-failed-test-journals'
) )
ops += [f'gh run download {id} --name {artifact} -D ci/{artifact}'] ops += [f'gh run download {id} --name {artifact} -D ci/{artifact}']
journal_file = Path(f'ci/{artifact}/test/journal/{name}.journal') journal_file = Path(f'ci/{artifact}/test/journal/{name}.journal')