From 4ebcb8677234a8be844a8b91c17f77ce5df747fc Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 30 Aug 2023 08:12:02 +0000 Subject: [PATCH 1/2] Remove redundant hack for subdirectory template. --- pyproject.toml | 10 +++------- template/pyproject.toml.jinja | 16 +++++----------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8e2a72c2..406eba15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,9 +43,6 @@ issue = "https://github.com/serious-scaffold/serious-scaffold-python/issues" fail_under = 100 [tool.coverage.run] -omit = [ - "src/{{ module_name }}/**", -] source = [ "serious_scaffold", ] @@ -61,9 +58,6 @@ disallow_untyped_defs = true enable_error_code = [ "ignore-without-code", ] -exclude = [ - "src/{{ module_name }}", -] no_implicit_optional = true show_error_codes = true warn_return_any = true @@ -78,6 +72,9 @@ log_format = "%(asctime)s %(levelname)s %(message)s" minversion = "6.0" [tool.ruff] +extend-exclude = [ + "template", +] extend-ignore = [ "D203", "D204", @@ -97,7 +94,6 @@ src = ["src"] [tool.ruff.per-file-ignores] "docs/conf.py" = ["INP001"] -"src/\\{\\{ module_name \\}\\}/__init__.py" = ["N999"] "test/*" = ["S101"] [tool.setuptools.dynamic] diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 98211b97..b2a10057 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -54,11 +54,6 @@ issue = "https://{{ repo_base_url() }}/issues" fail_under = {{ coverage_threshold }} [tool.coverage.run] -omit = [ -[%- if project_name == "Serious Scaffold Python" %] - "src/{{ '{{ module_name }}' }}/**", -[%- endif %] -] source = [ "{{ module_name }}", ] @@ -74,11 +69,6 @@ disallow_untyped_defs = true enable_error_code = [ "ignore-without-code", ] -exclude = [ -[%- if project_name == "Serious Scaffold Python" %] - "src/{{ '{{ module_name }}' }}", -[%- endif %] -] no_implicit_optional = true show_error_codes = true warn_return_any = true @@ -93,6 +83,11 @@ log_format = "%(asctime)s %(levelname)s %(message)s" minversion = "6.0" [tool.ruff] +[%- if project_name == "Serious Scaffold Python" %] +extend-exclude = [ + "template", +] +[%- endif %] extend-ignore = [ "D203", "D204", @@ -112,7 +107,6 @@ src = ["src"] [tool.ruff.per-file-ignores] "docs/conf.py" = ["INP001"] -"src/\\{\\{ module_name \\}\\}/__init__.py" = ["N999"] "test/*" = ["S101"] [tool.setuptools.dynamic] From 82172a5fc3c4d6aa8ee9d3a7dced7eea5de4a233 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 30 Aug 2023 09:36:01 +0000 Subject: [PATCH 2/2] Refine lint configuration. --- .pre-commit-config.yaml | 4 ++-- Makefile | 8 ++++---- pyproject.toml | 15 ++++++++++++++- template/.pre-commit-config.yaml | 4 ++-- template/Makefile.jinja | 8 ++++---- template/pyproject.toml.jinja | 21 ++++++++++++++++++++- 6 files changed, 46 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 23ffb7ea..cc8203b3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: name: black types: - python - - entry: pipenv run python -m isort + - entry: pipenv run python -m isort --filter-files id: isort language: system name: isort @@ -54,7 +54,7 @@ repos: require_serial: true types: - python - - entry: pipenv run python -m ruff + - entry: pipenv run python -m ruff --force-exclude id: ruff language: system name: ruff diff --git a/Makefile b/Makefile index 7cce668e..3344e47e 100644 --- a/Makefile +++ b/Makefile @@ -57,19 +57,19 @@ dev: # Check lint with black. black: - ${PIPRUN} python -m black --check docs test src + ${PIPRUN} python -m black --check . # Check lint with isort. isort: - ${PIPRUN} python -m isort . + ${PIPRUN} python -m isort --check . # Check lint with mypy. mypy: - ${PIPRUN} python -m mypy docs test src + ${PIPRUN} python -m mypy . # Check lint with ruff. ruff: - ${PIPRUN} python -m ruff docs test src + ${PIPRUN} python -m ruff . # Check lint with toml-sort. toml-sort: diff --git a/pyproject.toml b/pyproject.toml index 406eba15..2c4fb5b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,13 @@ serious-scaffold-cli = "serious_scaffold.cli:app" homepage = "https://github.com/serious-scaffold/serious-scaffold-python/" issue = "https://github.com/serious-scaffold/serious-scaffold-python/issues" +[tool.black] +force-exclude = ''' +( + template/.* +) +''' + [tool.coverage.report] fail_under = 100 @@ -48,7 +55,10 @@ source = [ ] [tool.isort] -filter_files = true +color_output = true +extend_skip = [ + "template", +] profile = "black" [tool.mypy] @@ -58,6 +68,9 @@ disallow_untyped_defs = true enable_error_code = [ "ignore-without-code", ] +exclude = [ + "template", +] no_implicit_optional = true show_error_codes = true warn_return_any = true diff --git a/template/.pre-commit-config.yaml b/template/.pre-commit-config.yaml index 23ffb7ea..cc8203b3 100644 --- a/template/.pre-commit-config.yaml +++ b/template/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: name: black types: - python - - entry: pipenv run python -m isort + - entry: pipenv run python -m isort --filter-files id: isort language: system name: isort @@ -54,7 +54,7 @@ repos: require_serial: true types: - python - - entry: pipenv run python -m ruff + - entry: pipenv run python -m ruff --force-exclude id: ruff language: system name: ruff diff --git a/template/Makefile.jinja b/template/Makefile.jinja index 15e6f22f..2ec50f10 100644 --- a/template/Makefile.jinja +++ b/template/Makefile.jinja @@ -59,19 +59,19 @@ dev: # Check lint with black. black: - ${PIPRUN} python -m black --check docs test src + ${PIPRUN} python -m black --check . # Check lint with isort. isort: - ${PIPRUN} python -m isort . + ${PIPRUN} python -m isort --check . # Check lint with mypy. mypy: - ${PIPRUN} python -m mypy docs test src + ${PIPRUN} python -m mypy . # Check lint with ruff. ruff: - ${PIPRUN} python -m ruff docs test src + ${PIPRUN} python -m ruff . # Check lint with toml-sort. toml-sort: diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index b2a10057..c03a7467 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -49,6 +49,15 @@ requires-python = ">={{ min_py }}" [project.urls] homepage = "https://{{ repo_url() }}/" issue = "https://{{ repo_base_url() }}/issues" +[%- if project_name == "Serious Scaffold Python" %] + +[tool.black] +force-exclude = ''' +( + template/.* +) +''' +[%- endif %] [tool.coverage.report] fail_under = {{ coverage_threshold }} @@ -59,7 +68,12 @@ source = [ ] [tool.isort] -filter_files = true +color_output = true +[%- if project_name == "Serious Scaffold Python" %] +extend_skip = [ + "template", +] +[%- endif %] profile = "black" [tool.mypy] @@ -69,6 +83,11 @@ disallow_untyped_defs = true enable_error_code = [ "ignore-without-code", ] +[%- if project_name == "Serious Scaffold Python" %] +exclude = [ + "template", +] +[%- endif %] no_implicit_optional = true show_error_codes = true warn_return_any = true