Skip to content

Commit 4a502b8

Browse files
authored
Restore Docformatter pre-commit check. (#2412)
1 parent 19a6d8e commit 4a502b8

33 files changed

Lines changed: 125 additions & 103 deletions

.pre-commit-config.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ repos:
88
- id: check-docstring-first
99
- id: end-of-file-fixer
1010
- id: trailing-whitespace
11-
# Docformatter 1.7.5 isn't compatible with Pre-commit 4.0
12-
# - repo: https://github.com/PyCQA/docformatter
13-
# rev: v1.7.5
14-
# hooks:
15-
# - id: docformatter
16-
# args: [--in-place, --black]
11+
- repo: https://github.com/PyCQA/docformatter
12+
rev: v1.7.7
13+
hooks:
14+
- id: docformatter
15+
args: [--in-place, --black]
1716
- repo: https://github.com/astral-sh/ruff-pre-commit
1817
rev: v0.12.4
1918
hooks:

src/briefcase/bootstraps/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def pyproject_extra_content(self) -> str | None:
123123
def post_generate(self, base_path: Path) -> None:
124124
"""Runs after the template has been generated.
125125
126-
This can be used to produce any additional files that the base
127-
template doesn't provide.
126+
This can be used to produce any additional files that the base template doesn't
127+
provide.
128128
129129
:param base_path: The path to the root of the generated project.
130130
"""

src/briefcase/commands/base.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ def unbuilt_executable_path(self, app) -> Path:
442442
return self.binary_executable_path(app).parent / f"Stub{suffix}"
443443

444444
def bundle_package_path(self, app):
445-
"""The root path of the content in the bundle generated by Briefcase
446-
that will be packaged for distribution.
445+
"""The root path of the content in the bundle generated by Briefcase that will
446+
be packaged for distribution.
447447
448448
This may be overridden if the user manually specifies external_package_path.
449449
@@ -466,8 +466,8 @@ def package_path(self, app):
466466
return self.bundle_package_path(app)
467467

468468
def bundle_package_executable_path(self, app):
469-
"""The path, relative to the package path generated by Briefcase, of the
470-
binary in the packaged app that is executed as the app.
469+
"""The path, relative to the package path generated by Briefcase, of the binary
470+
in the packaged app that is executed as the app.
471471
472472
This may be overridden if the user manually specifies a
473473
external_package_executable_path.
@@ -481,8 +481,8 @@ def bundle_package_executable_path(self, app):
481481
raise NotImplementedError()
482482

483483
def package_executable_path(self, app):
484-
"""The path, relative to the package path, of the binary that is
485-
executed as the app.
484+
"""The path, relative to the package path, of the binary that is executed as the
485+
app.
486486
487487
:param app: The app config
488488
"""
@@ -777,7 +777,8 @@ def verify_app_template(self, app: AppConfig):
777777
)
778778

779779
def verify_required_python(self, app: AppConfig):
780-
"""Verify that the running version of Python meets the project's specifications."""
780+
"""Verify that the running version of Python meets the project's
781+
specifications."""
781782

782783
requires_python = getattr(self.global_config, "requires_python", None)
783784
if not requires_python:

src/briefcase/commands/convert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,8 @@ def find_changelog_filename(base_path):
807807
"""Find a valid changelog file in a given directory.
808808
809809
:param base_path: The directory to search
810-
:returns: The filename of the changelog that was found; None if a changelog
811-
with a known name could not be found.
810+
:returns: The filename of the changelog that was found; None if a changelog with a
811+
known name could not be found.
812812
"""
813813
changelog_formats = [
814814
f"{name}{extension}"

src/briefcase/commands/create.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,9 @@ def _write_requirements_file(
524524
:param requires: The full list of requirements
525525
:param requirements_path: The full path to a requirements.txt file that will be
526526
written.
527-
:param requirement_installer_args_path: The full path to where newline
528-
delimited additional requirement installer argumentss should be written if
529-
the template supports it.
527+
:param requirement_installer_args_path: The full path to where newline delimited
528+
additional requirement installer argumentss should be written if the
529+
template supports it.
530530
"""
531531

532532
with self.console.wait_bar("Writing requirements file..."):

src/briefcase/commands/package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def clean_dist_folder(self, app, **options):
4848
:param app: The app being packaged
4949
:param options: Any additional arguments passed to the package command. This is
5050
required because backends that need to *resume* packaging (e.g.,
51-
notarization on macOS), need to ignore the "clean" behavior and preserve
52-
the existing artefact.
51+
notarization on macOS), need to ignore the "clean" behavior and preserve the
52+
existing artefact.
5353
"""
5454
if self.distribution_path(app).exists():
5555
self.distribution_path(app).unlink()

src/briefcase/config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def parsed_version(version):
246246

247247

248248
def parse_boolean(value: str) -> bool:
249-
"""Takes a string value and attempts to convert to a boolean value"""
249+
"""Takes a string value and attempts to convert to a boolean value."""
250250

251251
truth_vals = {"true", "t", "yes", "y", "1", "on"}
252252
false_vals = {"false", "f", "no", "n", "0", "off"}
@@ -283,14 +283,14 @@ def copy(self):
283283
return type(self)(**self.__dict__)
284284

285285
def setdefault(self, field_name, default_value):
286-
"""Return the field_name field or, if it does not exist, create it
287-
to hold default_value.
286+
"""Return the field_name field or, if it does not exist, create it to hold
287+
default_value.
288288
289289
Behaves similarly to dict.setdefault().
290290
291291
:param field_name: The name of the desired/new field.
292-
:param default_value: The value to assign to self.field_name if it
293-
does not already exist.
292+
:param default_value: The value to assign to self.field_name if it does not
293+
already exist.
294294
"""
295295
if not hasattr(self, field_name):
296296
setattr(self, field_name, default_value)

src/briefcase/console.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ def boolean_question(
969969
default: bool | None = None,
970970
override_value: str | None = None,
971971
) -> bool:
972-
"""Ask the user a boolean question who's answer requires selecting yes/no
972+
"""Ask the user a boolean question who's answer requires selecting yes/no.
973973
974974
:param description: A short description of the question being asked. This text
975975
is used in prompts and a header bar prefacing the question.
@@ -978,7 +978,8 @@ def boolean_question(
978978
:param override_value: A pre-selected answer for the question. This can be used
979979
to shortcut asking the question, such as when a command line option provides
980980
a value. If provided and valid, the header bar will be displayed, but the
981-
intro paragraph and option list will not. Will take the provided string and attempt to parse into bool
981+
intro paragraph and option list will not. Will take the provided string and
982+
attempt to parse into bool
982983
:returns: The user's chosen answer or none if closed without input
983984
"""
984985

src/briefcase/integrations/android_sdk.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,8 +1629,8 @@ def logcat_tail(self, since: datetime):
16291629
raise BriefcaseCommandError("Error starting ADB logcat.") from e
16301630

16311631
def forward(self, host_port: int, device_port: int):
1632-
"""Use the forward command to set up arbitrary port forwarding, which
1633-
forwards requests on a specific host port to a different port on a device.
1632+
"""Use the forward command to set up arbitrary port forwarding, which forwards
1633+
requests on a specific host port to a different port on a device.
16341634
16351635
:param host_port: The port on the host that should be forwarded to the device
16361636
:param device_port: The port on the device
@@ -1669,8 +1669,8 @@ def forward_remove(self, host_port: int):
16691669
raise BriefcaseCommandError("Error starting 'adb forward --remove'.") from e
16701670

16711671
def reverse(self, device_port: int, host_port: int):
1672-
"""Use the reverse command to set up arbitrary port forwarding, which
1673-
forwards requests on a specific device port to a different port on the host.
1672+
"""Use the reverse command to set up arbitrary port forwarding, which forwards
1673+
requests on a specific device port to a different port on the host.
16741674
16751675
:param device_port: The port on the device that should be forwarded to the host
16761676
:param host_port: The port on the host

src/briefcase/integrations/cookiecutter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def bool_attr(obj):
141141
return "true" if obj else "false"
142142

143143
def xml_escape(obj):
144-
"""Filter to escape characters <, >, &, " and '"""
144+
"""Filter to escape characters <, >, &, " and '."""
145145
return escape(obj)
146146

147147
def xml_attr(obj):

0 commit comments

Comments
 (0)