ruff: Enable E5 check

... to enforce maximum line length, to keep consistent code format.

Note that E501 check is disabled in test code now, until we decide how
to update ~50 lines violating the limit due to too long names.

Change-Id: I122c8b9035d6381dafb34438517c26b01e5201f5
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-12-11 02:42:46 +09:00
parent f8effe997e
commit 92a277ff4c
10 changed files with 41 additions and 23 deletions

View File

@@ -69,8 +69,8 @@ def assert_no_duplicated_setup(logical_line, filename):
return return
yield ( yield (
0, 0,
f"O401: client_manager.{service} mocks are already provided by " f"O401: client_manager.{service} mocks are already provided "
f"the {service} service's FakeClientMixin class", f"by the {service} service's FakeClientMixin class",
) )
@@ -89,7 +89,7 @@ def assert_use_of_client_aliases(logical_line):
yield (0, f"0402: prefer {service}_client to sdk_connection.{service}") yield (0, f"0402: prefer {service}_client to sdk_connection.{service}")
if match := re.match( if match := re.match(
r'(self\.app\.client_manager\.(compute|network|image)+\.[a-z_]+) = mock.Mock', r'(self\.app\.client_manager\.(compute|network|image)+\.[a-z_]+) = mock.Mock', # noqa: E501
logical_line, logical_line,
): ):
yield ( yield (

View File

@@ -256,7 +256,10 @@ class APIv1(api.BaseAPI):
# object's name in the container. # object's name in the container.
object_name_str = name if name else object object_name_str = name if name else object
full_url = f"{urllib.parse.quote(container)}/{urllib.parse.quote(object_name_str)}" full_url = (
f"{urllib.parse.quote(container)}/"
f"{urllib.parse.quote(object_name_str)}"
)
with open(object, 'rb') as f: with open(object, 'rb') as f:
response = self.create( response = self.create(
full_url, full_url,

View File

@@ -99,7 +99,8 @@ def find_service_sdk(identity_client, name_type_or_id):
if next(services, None): if next(services, None):
msg = _( msg = _(
"Multiple service matches found for '%(query)s', use an ID to be more specific." "Multiple service matches found for '%(query)s', "
"use an ID to be more specific."
) % {"query": name_type_or_id} ) % {"query": name_type_or_id}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@@ -315,8 +315,9 @@ class ListGroup(command.Lister):
parsed_args.user_domain, parsed_args.user_domain,
) )
if domain: if domain:
# NOTE(0weng): The API doesn't actually support filtering additionally by domain_id, # NOTE(0weng): The API doesn't actually support filtering
# so this doesn't really do anything. # additionally by domain_id, so this doesn't really do
# anything.
data = identity_client.user_groups(user, domain_id=domain) data = identity_client.user_groups(user, domain_id=domain)
else: else:
data = identity_client.user_groups(user) data = identity_client.user_groups(user)

View File

@@ -420,7 +420,8 @@ class ListUser(command.Lister):
dest='is_enabled', dest='is_enabled',
default=None, default=None,
help=_( help=_(
'List only enabled users, does nothing with --project and --group' 'List only enabled users, does nothing with '
'--project and --group'
), ),
) )
parser.add_argument( parser.add_argument(
@@ -429,7 +430,8 @@ class ListUser(command.Lister):
dest='is_enabled', dest='is_enabled',
default=None, default=None,
help=_( help=_(
'List only disabled users, does nothing with --project and --group' 'List only disabled users, does nothing with '
'--project and --group'
), ),
) )
return parser return parser

View File

@@ -127,7 +127,8 @@ class DeleteMetadefProperty(command.Command):
nargs="*", nargs="*",
help=_( help=_(
"Metadef properties to delete (name) " "Metadef properties to delete (name) "
"(omit this argument to delete all properties in the namespace)" "(omit this argument to delete all properties "
"in the namespace)"
), ),
) )
return parser return parser

View File

@@ -171,7 +171,8 @@ class CreateVolumeType(command.ShowOne):
default=False, default=False,
help=_( help=_(
"Enabled replication for this volume type " "Enabled replication for this volume type "
"(this is an alias for '--property replication_enabled=<is> True') " "(this is an alias for "
"'--property replication_enabled=<is> True') "
"(requires driver support)" "(requires driver support)"
), ),
) )
@@ -181,7 +182,8 @@ class CreateVolumeType(command.ShowOne):
dest='availability_zones', dest='availability_zones',
help=_( help=_(
"Set an availability zone for this volume type " "Set an availability zone for this volume type "
"(this is an alias for '--property RESKEY:availability_zones:<az>') " "(this is an alias for "
"'--property RESKEY:availability_zones:<az>') "
"(repeat option to set multiple availability zones)" "(repeat option to set multiple availability zones)"
), ),
) )
@@ -534,7 +536,8 @@ class SetVolumeType(command.Command):
default=False, default=False,
help=_( help=_(
"Enabled replication for this volume type " "Enabled replication for this volume type "
"(this is an alias for '--property replication_enabled=<is> True') " "(this is an alias for "
"'--property replication_enabled=<is> True') "
"(requires driver support)" "(requires driver support)"
), ),
) )
@@ -544,7 +547,8 @@ class SetVolumeType(command.Command):
dest='availability_zones', dest='availability_zones',
help=_( help=_(
"Set an availability zone for this volume type " "Set an availability zone for this volume type "
"(this is an alias for '--property RESKEY:availability_zones:<az>') " "(this is an alias for "
"'--property RESKEY:availability_zones:<az>') "
"(repeat option to set multiple availability zones)" "(repeat option to set multiple availability zones)"
), ),
) )

View File

@@ -458,7 +458,7 @@ class ListVolumeAttachment(command.Lister):
} }
# Update search option with `filters` # Update search option with `filters`
# if AppendFilters.filters: # if AppendFilters.filters:
# search_opts.update(shell_utils.extract_filters(AppendFilters.filters)) # search_opts.update(shell_utils.extract_filters(AppendFilters.filters)) # noqa: E501
# TODO(stephenfin): Implement sorting # TODO(stephenfin): Implement sorting
attachments = volume_client.attachments( attachments = volume_client.attachments(

View File

@@ -172,7 +172,8 @@ class CreateVolumeType(command.ShowOne):
default=False, default=False,
help=_( help=_(
"Enabled replication for this volume type " "Enabled replication for this volume type "
"(this is an alias for '--property replication_enabled=<is> True') " "(this is an alias for "
"'--property replication_enabled=<is> True') "
"(requires driver support)" "(requires driver support)"
), ),
) )
@@ -182,7 +183,8 @@ class CreateVolumeType(command.ShowOne):
dest='availability_zones', dest='availability_zones',
help=_( help=_(
"Set an availability zone for this volume type " "Set an availability zone for this volume type "
"(this is an alias for '--property RESKEY:availability_zones:<az>') " "(this is an alias for "
"'--property RESKEY:availability_zones:<az>') "
"(repeat option to set multiple availability zones)" "(repeat option to set multiple availability zones)"
), ),
) )
@@ -447,7 +449,8 @@ class ListVolumeType(command.Lister):
default=False, default=False,
help=_( help=_(
"List only volume types with replication enabled " "List only volume types with replication enabled "
"(this is an alias for '--property replication_enabled=<is> True') " "(this is an alias for "
"'--property replication_enabled=<is> True') "
"(supported by --os-volume-api-version 3.52 or above)" "(supported by --os-volume-api-version 3.52 or above)"
), ),
) )
@@ -457,7 +460,8 @@ class ListVolumeType(command.Lister):
dest='availability_zones', dest='availability_zones',
help=_( help=_(
"List only volume types with this availability configured " "List only volume types with this availability configured "
"(this is an alias for '--property RESKEY:availability_zones:<az>') " "(this is an alias for "
"'--property RESKEY:availability_zones:<az>') "
"(repeat option to filter on multiple availability zones)" "(repeat option to filter on multiple availability zones)"
), ),
) )
@@ -616,7 +620,8 @@ class SetVolumeType(command.Command):
default=False, default=False,
help=_( help=_(
"Enabled replication for this volume type " "Enabled replication for this volume type "
"(this is an alias for '--property replication_enabled=<is> True') " "(this is an alias for "
"'--property replication_enabled=<is> True') "
"(requires driver support)" "(requires driver support)"
), ),
) )
@@ -626,7 +631,8 @@ class SetVolumeType(command.Command):
dest='availability_zones', dest='availability_zones',
help=_( help=_(
"Set an availability zone for this volume type " "Set an availability zone for this volume type "
"(this is an alias for '--property RESKEY:availability_zones:<az>') " "(this is an alias for "
"'--property RESKEY:availability_zones:<az>') "
"(repeat option to set multiple availability zones)" "(repeat option to set multiple availability zones)"
), ),
) )

View File

@@ -749,7 +749,7 @@ quote-style = "preserve"
docstring-code-format = true docstring-code-format = true
[tool.ruff.lint] [tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "S", "UP"] select = ["E4", "E5", "E7", "E9", "F", "S", "UP"]
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"openstackclient/tests/*" = ["S"] "openstackclient/tests/*" = ["E501", "S"]