File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,14 @@ lint.select = [
6262 " C4" , # flake8-comprehensions - https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
6363 " E" , # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
6464 " F" , # pyflakes rules - https://docs.astral.sh/ruff/rules/#pyflakes-f
65+ " N" , # pep8-naming - https://docs.astral.sh/ruff/rules/#pep8-naming-n
6566 " W" , # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#warning-w
6667 " I" , # isort - https://docs.astral.sh/ruff/rules/#isort-i
6768 " UP" , # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up
6869]
70+
71+ [tool .ruff .lint .per-file-ignores ]
72+ # Ignore variable names inside the template because ruff doesn't
73+ # work well with jinja templating. Any violations of N rules inside
74+ # the template are caught by the tests.
75+ "template/**/*" = [" N" ]
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ lint.select = [
109109 "C4", # flake8-comprehensions - https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
110110 "E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
111111 "F", # pyflakes rules - https://docs.astral.sh/ruff/rules/#pyflakes-f
112+ "N", # pep8-naming - https://docs.astral.sh/ruff/rules/#pep8-naming-n
112113 "W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#warning-w
113114 "I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
114115 "UP", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up
Original file line number Diff line number Diff line change @@ -223,6 +223,21 @@ def __init__(self):
223223 run ("ruff check" )
224224
225225
226+ def test_pep8_naming (tmp_path : Path ):
227+ code = """
228+ myVariable = "foo"
229+ """
230+
231+ copy_project (tmp_path )
232+ run = make_venv (tmp_path )
233+
234+ src_file = tmp_path / "src" / "python_copier_template_example" / "bad_example.py"
235+ with src_file .open ("w" ) as stream :
236+ stream .write (code )
237+ with pytest .raises (AssertionError , match = r"N816 .*" ):
238+ run ("ruff check" )
239+
240+
226241def test_pyright_works_in_standard_typing_mode (tmp_path : Path ):
227242 copy_project (tmp_path , type_checker = "pyright" , strict_typing = False )
228243 pyproject_toml = tmp_path / "pyproject.toml"
You can’t perform that action at this time.
0 commit comments