Skip to content
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
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ lint.select = [
"C4", # flake8-comprehensions - https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
"F", # pyflakes rules - https://docs.astral.sh/ruff/rules/#pyflakes-f
"N", # pep8-naming - https://docs.astral.sh/ruff/rules/#pep8-naming-n
"W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#warning-w
"I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
"UP", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up
]

[tool.ruff.lint.per-file-ignores]
# Ignore variable names inside the template because ruff doesn't
# work well with jinja templating. Any violations of N rules inside
# the template are caught by the tests.
"template/**/*" = ["N"]
1 change: 1 addition & 0 deletions template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ lint.select = [
"C4", # flake8-comprehensions - https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
"F", # pyflakes rules - https://docs.astral.sh/ruff/rules/#pyflakes-f
"N", # pep8-naming - https://docs.astral.sh/ruff/rules/#pep8-naming-n
"W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#warning-w
"I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
"UP", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up
Expand Down
15 changes: 15 additions & 0 deletions tests/test_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,21 @@ def __init__(self):
run("ruff check")


def test_pep8_naming(tmp_path: Path):
code = """
myVariable = "foo"
"""

copy_project(tmp_path)
run = make_venv(tmp_path)

src_file = tmp_path / "src" / "python_copier_template_example" / "bad_example.py"
with src_file.open("w") as stream:
stream.write(code)
with pytest.raises(AssertionError, match=r"N816 .*"):
run("ruff check")


def test_pyright_works_in_standard_typing_mode(tmp_path: Path):
copy_project(tmp_path, type_checker="pyright", strict_typing=False)
pyproject_toml = tmp_path / "pyproject.toml"
Expand Down