Skip to content

Commit

Permalink
Fix linting the template check (#287)
Browse files Browse the repository at this point in the history
Noticed during my test of issue templates #273, that this was actually
not working!

This should fail, due to dodgy linting.

---------

Co-authored-by: David Stansby <dstansby@gmail.com>
  • Loading branch information
paddyroddy and dstansby authored Jan 30, 2024
1 parent 6a4c223 commit 8265291
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@ jobs:
run: cookiecutter . --no-input --output-dir cookie-template

- name: Run pre-commit
run: pre-commit run --all-files --color always --verbose
working-directory: cookie-template
run: |-
git add .
pre-commit run --all-files --color always --verbose
working-directory: cookie-template/python-template
21 changes: 17 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ repos:
- id: ruff
args:
- --config=pyproject.toml
exclude: "{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}"
exclude: |-
(?x)(
{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}
)
- id: ruff-format
args:
- --config=pyproject.toml
Expand All @@ -17,7 +20,10 @@ repos:
rev: v0.23.1
hooks:
- id: toml-sort-fix
exclude: "{{cookiecutter.project_slug}}/pyproject.toml"
exclude: |-
(?x)(
{{cookiecutter.project_slug}}/pyproject.toml
)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
Expand All @@ -26,12 +32,19 @@ repos:
- --config-file=pyproject.toml
additional_dependencies:
- pytest
exclude: "{{cookiecutter.project_slug}}/(src/{{cookiecutter.package_name}}|tests)"
exclude: |-
(?x)(
{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}|
{{cookiecutter.project_slug}}/tests
)
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
exclude: "{{cookiecutter.project_slug}}/.github/workflows/tests.yml"
exclude: |-
(?x)(
{{cookiecutter.project_slug}}/.github/workflows/tests.yml
)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,4 +649,4 @@ what you want to do, use the GNU Lesser General Public License instead of this
License. But first, please read
&lt;<http://www.gnu.org/philosophy/why-not-lgpl.html>&gt;.

{%- endif -%}
{%- endif %}
7 changes: 2 additions & 5 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ paths.source = [

[tool.mypy]
explicit_package_bases = true
plugins = [
"numpy.typing.mypy_plugin",
]

[tool.pytest.ini_options]
addopts = """
Expand All @@ -74,7 +71,7 @@ testpaths = [
fix = true
force-exclude = true
ignore = [
"COM812", # trailing commas (ruff-format recommended)
"COM812", # trailing commas (ruff-format recommended)
"D203", # no-blank-line-before-class
"D212", # multi-line-summary-first-line
"D407", # removed dashes lines under sections
Expand All @@ -86,7 +83,7 @@ per-file-ignores = {"tests*" = [
"S101",
]}
select = [
"ALL"
"ALL",
]
target-version = "py{{cookiecutter.min_python_version | replace('.', '')}}"
isort.known-first-party = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
"""{{cookiecutter.package_name}} package."""
from ._version import __version__ # noqa: F401

0 comments on commit 8265291

Please sign in to comment.