Skip to content

Commit

Permalink
Merge pull request #10 from fpgmaas/fix/linting-docs
Browse files Browse the repository at this point in the history
Fix ruff configuration and linting docs
  • Loading branch information
fpgmaas authored Sep 25, 2024
2 parents 657bf42 + c210ee1 commit 664ae98
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 32 deletions.
27 changes: 6 additions & 21 deletions docs/features/linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ This command will run the following tools:

```
[tool.ruff]
target-version = "py37"
target-version = "py39"
line-length = 120
fix = false
fix = true
select = [
# flake8-2020
"YTT",
Expand All @@ -32,8 +32,6 @@ select = [
"C4",
# flake8-debugger
"T10",
# flake8-print
"T20",
# flake8-simplify
"SIM",
# isort
Expand All @@ -60,6 +58,9 @@ ignore = [
"E731",
]
[tool.ruff.format]
preview = true
[tool.ruff.per-file-ignores]
"tests/*" = ["S101"]
```
Expand All @@ -86,23 +87,7 @@ exclude = [

# deptry

[deptry](https://github.com/fpgmaas/deptry) is used to check the code for dependency issues, and it's configuration and can be edited in `pyproject.toml`.

```toml
[tool.mypy]
disallow_untyped_defs = "True"
disallow_any_unimported = "True"
no_implicit_optional = "True"
check_untyped_defs = "True"
warn_return_any = "True"
warn_unused_ignores = "True"
show_error_codes = "True"
exclude = [
'\.venv',
'{{cookiecutter.project_name}}',
'tests'
]
```
[deptry](https://github.com/fpgmaas/deptry) is used to check the code for dependency issues, and it can be configured by adding a `[tool.deptry]` section in `pyproject.toml`. For more information, see [this section](https://deptry.com/usage/#configuration) documentation of deptry.

# Prettier

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ extend_exclude = [
DEP002 = ["cookiecutter"]

[tool.ruff]
target-version = "py37"
target-version = "py39"
line-length = 120
fix = true

Expand Down
8 changes: 2 additions & 6 deletions {{cookiecutter.project_name}}/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@
"name": "{{cookiecutter.project_name}}",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"features": {
},
"features": {},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"editorconfig.editorconfig",
],
"extensions": ["ms-python.python", "editorconfig.editorconfig"],
"settings": {
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
Expand Down
10 changes: 6 additions & 4 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ testpaths = ["tests"]
target-version = "py39"
line-length = 120
fix = true

[tool.ruff.lint]
select = [
# flake8-2020
"YTT",
Expand Down Expand Up @@ -86,6 +88,9 @@ ignore = [
"E731",
]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101"]

[tool.ruff.format]
preview = true

Expand All @@ -96,7 +101,4 @@ skip_empty = true
[tool.coverage.run]
branch = true
source = ["{{cookiecutter.project_slug}}"]
{% endif%}

[tool.ruff.per-file-ignores]
"tests/*" = ["S101"]
{% endif %}

0 comments on commit 664ae98

Please sign in to comment.