Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve some linter and formatter rules. #524

Merged
merged 2 commits into from
Dec 9, 2023
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
1 change: 1 addition & 0 deletions docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 9 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]


Expand All @@ -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"]
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/hookspecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/_pytask/skipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down