diff --git a/docs/source/changes.md b/docs/source/changes.md index 554ff23f..15a414d6 100644 --- a/docs/source/changes.md +++ b/docs/source/changes.md @@ -15,6 +15,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and {func}`~pytask.task`. Closes {issue}`512`. - {pull}`522` improves the issue templates. - {pull}`523` refactors `_pytask.console._get_file`. +- {pull}`524` improves some linting and formatter rules. ## 0.4.4 - 2023-12-04 diff --git a/pyproject.toml b/pyproject.toml index 4d5e3cac..47b9c961 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,21 +106,20 @@ target-version = "py38" select = ["ALL"] fix = true ignore = [ + "FBT", # flake8-boolean-trap "I", # ignore isort "TRY", # ignore tryceratops. # Others. - "ISC001", - "S101", # raise errors for asserts. "ANN101", # type annotating self "ANN102", # type annotating cls - "FBT", # flake8-boolean-trap "ANN401", # flake8-annotate typing.Any - "PD", # pandas-vet - "COM812", # trailing comma missing, but black takes care of that - "D401", # imperative mood for first line. too many false-positives. + "COM812", # Comply with ruff-format. + "ISC001", # Comply with ruff-format. + "PD901", # Avoid generic df for dataframes. + "S101", # raise errors for asserts. + "S603", # Call check with subprocess.run. + "S607", # Call subprocess.run with partial executable path. "SLF001", # access private members. - "S603", - "S607", ] @@ -131,7 +130,7 @@ ignore = [ "src/_pytask/outcomes.py" = ["N818"] "src/_pytask/dag.py" = ["B023"] "tests/test_capture.py" = ["T201", "PT011"] -"tests/*" = ["D", "ANN", "PLR2004", "S101"] +"tests/*" = ["ANN", "D", "FBT", "PLR2004", "S101"] "tests/test_jupyter/*" = ["INP001"] "scripts/*" = ["D", "INP001"] "docs/source/conf.py" = ["D401", "INP001"] @@ -185,7 +184,7 @@ module = ["_pytask.hookspecs"] disable_error_code = ["empty-body"] [tool.codespell] -ignore-words-list = "falsy, hist, ines, unparseable" +skip = "*.js,*/termynal.css" [tool.refurb] python_version = "3.8" diff --git a/src/_pytask/debugging.py b/src/_pytask/debugging.py index 28ac9937..7da0d985 100644 --- a/src/_pytask/debugging.py +++ b/src/_pytask/debugging.py @@ -374,7 +374,7 @@ class PdbTrace: def pytask_execute_task( session: Session, task: PTask ) -> Generator[None, None, None]: - """Wrapping the task function with a tracer.""" + """Wrap the task function with a tracer.""" if isinstance(task, PTask): wrap_function_for_tracing(session, task) yield diff --git a/src/_pytask/hookspecs.py b/src/_pytask/hookspecs.py index 8e944e9f..bea498e4 100644 --- a/src/_pytask/hookspecs.py +++ b/src/_pytask/hookspecs.py @@ -174,7 +174,7 @@ def pytask_collect_task_protocol( def pytask_collect_task_setup( session: Session, path: Path | None, name: str, obj: Any ) -> None: - """Steps before collecting a task.""" + """Set up collecting a task.""" @hookspec(firstresult=True) diff --git a/src/_pytask/skipping.py b/src/_pytask/skipping.py index e86d3d72..baba42d6 100644 --- a/src/_pytask/skipping.py +++ b/src/_pytask/skipping.py @@ -22,12 +22,12 @@ def skip_ancestor_failed(reason: str = "No reason provided.") -> str: - """Function to parse information in ``@pytask.mark.skip_ancestor_failed``.""" + """Parse information in ``@pytask.mark.skip_ancestor_failed``.""" return reason def skipif(condition: bool, *, reason: str) -> tuple[bool, str]: - """Function to parse information in ``@pytask.mark.skipif``.""" + """Parse information in ``@pytask.mark.skipif``.""" return condition, reason diff --git a/src/_pytask/traceback.py b/src/_pytask/traceback.py index c3f0ea61..e139f516 100644 --- a/src/_pytask/traceback.py +++ b/src/_pytask/traceback.py @@ -131,7 +131,7 @@ def _is_internal_or_hidden_traceback_frame( _PYTASK_DIRECTORY, ), ) -> bool: - """Returns ``True`` if traceback frame belongs to internal packages or is hidden. + """Return ``True`` if traceback frame belongs to internal packages or is hidden. Internal packages are ``_pytask`` and ``pluggy``. A hidden frame is indicated by a local variable called ``__tracebackhide__ = True``.