Skip to content

Commit

Permalink
Update lint dependencies and fix errors (#5)
Browse files Browse the repository at this point in the history
* Update lint dependencies and fix errors

Update dependencies to their latest version and constraints.

Fix issues with `make reformat` by ignoring some ruff rules where it
makes sense.

Apply the reformatted file changes.

* Address suggestions

* Allow print in _cli.py
  • Loading branch information
ekilmer authored Oct 13, 2023
1 parent aae0584 commit 54b74f2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
13 changes: 11 additions & 2 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ doc = [
]
test = ["pytest", "pytest-cov", "pretend", "coverage[toml]"]
lint = [
"black>=22.3.0",
"black ~= 23.0",
# NOTE: ruff is under active development, so we pin conservatively here
# and let Dependabot periodically perform this update.
"ruff < 0.0.255",
"ruff < 0.0.293",
"mypy >= 1.0",
"types-html5lib",
"types-requests",
Expand Down Expand Up @@ -86,6 +86,15 @@ line-length = 100
select = ["ALL"]
target-version = "py38"

[tool.ruff.per-file-ignores]
"{{ cookiecutter.module_slug }}/_cli.py" = [
"T201", # allow `print` in cli module
]
"test/**/*.py" = [
"D", # no docstrings in tests
"S101", # asserts are expected in tests
]

[tool.interrogate]
# don't enforce documentation coverage for packaging, testing, the virtual
# environment, or the CLI (which is documented separately).
Expand Down
Empty file.
4 changes: 3 additions & 1 deletion {{cookiecutter.project_slug}}/test/test_init.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Initial testing module."""
import {{ cookiecutter.module_slug }}

def test_version():

def test_version() -> None:
version = getattr({{ cookiecutter.module_slug }}, "__version__", None)
assert version is not None
assert isinstance(version, str)
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"""
The `{{ cookiecutter.module_slug }}` APIs.
"""
"""The `{{ cookiecutter.module_slug }}` APIs."""

__version__ = "{{ cookiecutter.version }}"
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
The `python -m {{ cookiecutter.module_slug }}` entrypoint.
"""
"""The `python -m {{ cookiecutter.module_slug }}` entrypoint."""

if __name__ == "__main__": # pragma: no cover
from {{ cookiecutter.module_slug }}._cli import main
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""
The `{{ cookiecutter.project_slug }}` entrypoint.
"""
"""The `{{ cookiecutter.project_slug }}` entrypoint."""


def main() -> None:
print("Hello, world!")

0 comments on commit 54b74f2

Please sign in to comment.