Skip to content

Commit

Permalink
Linter maintenance (#4507)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Feb 3, 2025
1 parent fbd9f11 commit 5314965
Show file tree
Hide file tree
Showing 14 changed files with 509 additions and 330 deletions.
10 changes: 5 additions & 5 deletions .config/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This file was autogenerated by uv via the following command:
# tox run deps
# tox run -e deps
ansible-compat==25.1.1 # via ansible-lint (pyproject.toml)
astroid==3.3.8 # via pylint
attrs==25.1.0 # via jsonschema, referencing
babel==2.17.0 # via mkdocs-material
beautifulsoup4==4.12.3 # via linkchecker, mkdocs-htmlproofer-plugin
beautifulsoup4==4.13.0 # via linkchecker, mkdocs-htmlproofer-plugin
black==25.1.0 # via ansible-lint (pyproject.toml)
boolean-py==4.0 # via license-expression
bracex==2.5.post1 # via wcmatch
Expand Down Expand Up @@ -81,7 +81,7 @@ pyproject-api==1.9.0 # via tox
pytest==8.3.4 # via pytest-instafail, pytest-mock, pytest-plus, pytest-xdist, ansible-lint (pyproject.toml)
pytest-instafail==0.5.0 # via ansible-lint (pyproject.toml)
pytest-mock==3.14.0 # via ansible-lint (pyproject.toml)
pytest-plus==0.8.0 # via ansible-lint (pyproject.toml)
pytest-plus==0.8.1 # via ansible-lint (pyproject.toml)
pytest-xdist==3.6.1 # via ansible-lint (pyproject.toml)
python-dateutil==2.9.0.post0 # via ghp-import, mkdocs-macros-plugin
python-slugify==8.0.4 # via mkdocs-monorepo-plugin
Expand All @@ -92,7 +92,6 @@ regex==2024.11.6 # via mkdocs-material
requests==2.32.3 # via linkchecker, mkdocs-htmlproofer-plugin, mkdocs-material
rpds-py==0.22.3 # via jsonschema, referencing
ruamel-yaml==0.18.10 # via ansible-lint (pyproject.toml)
ruamel-yaml-clib==0.2.12 # via ruamel-yaml, ansible-lint (pyproject.toml)
setproctitle==1.3.4 # via pytest-xdist
six==1.17.0 # via python-dateutil
soupsieve==2.6 # via beautifulsoup4
Expand All @@ -106,7 +105,7 @@ tomlkit==0.13.2 # via pylint
tox==4.24.1 # via ansible-lint (pyproject.toml)
types-jsonschema==4.23.0.20241208 # via ansible-lint (pyproject.toml)
types-pyyaml==6.0.12.20241230 # via ansible-lint (pyproject.toml)
typing-extensions==4.12.2 # via astroid, black, mypy, referencing, tox
typing-extensions==4.12.2 # via astroid, beautifulsoup4, black, mypy, referencing, tox
urllib3==2.3.0 # via requests
virtualenv==20.29.1 # via tox
watchdog==6.0.0 # via mkdocs
Expand All @@ -119,4 +118,5 @@ zipp==3.21.0 # via importlib-metadata
# ansible-core
# pip
# resolvelib
# ruamel-yaml-clib
# uv
6 changes: 6 additions & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ docutils
dotconfig
dotslash
drybjed
dunder
dzdo
ematcher
ematchtestfile
Expand All @@ -143,6 +144,7 @@ formatstr
formetting
fqcn
fqrn
fstring
fulltoc
fullwidth
gecos
Expand Down Expand Up @@ -270,6 +272,8 @@ pluginmanager
pmrun
podman
portchannel
posargs
preexec
prerun
prettierignore
programoutput
Expand Down Expand Up @@ -334,6 +338,7 @@ showlocals
shutil
signoff
simpletask
simplifiable
skippable
skiptasks
skiputils
Expand Down Expand Up @@ -405,6 +410,7 @@ untemplated
userbase
uwsgi
validable
vararg
varname
varnotset
varset
Expand Down
4 changes: 2 additions & 2 deletions .config/requirements-lock.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was autogenerated by uv via the following command:
# tox run deps
# tox run -e deps
ansible-compat==25.1.1 # via ansible-lint (pyproject.toml)
attrs==25.1.0 # via jsonschema, referencing
black==25.1.0 # via ansible-lint (pyproject.toml)
Expand All @@ -22,7 +22,6 @@ pyyaml==6.0.2 # via ansible-compat, ansible-core, yamllint, ansible-
referencing==0.36.2 # via jsonschema, jsonschema-specifications, ansible-lint (pyproject.toml)
rpds-py==0.22.3 # via jsonschema, referencing
ruamel-yaml==0.18.10 # via ansible-lint (pyproject.toml)
ruamel-yaml-clib==0.2.12 # via ruamel-yaml
subprocess-tee==0.4.2 # via ansible-compat, ansible-lint (pyproject.toml)
tomli==2.2.1 # via black
typing-extensions==4.12.2 # via black, referencing
Expand All @@ -33,3 +32,4 @@ zipp==3.21.0 # via importlib-metadata
# The following packages were excluded from the output:
# ansible-core
# resolvelib
# ruamel-yaml-clib
2 changes: 1 addition & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
- name: Install tox
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade "tox>=4.0.0" "tox-uv>=1.16.0" uv
python3 -m pip install --upgrade "tox>=4.0.0" "tox-uv>=1.20.2" uv
- name: Log installed dists
run: python3 -m pip freeze --all
Expand Down
41 changes: 24 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ exclude: >
(?x)^(
.config/constraints.txt|
.config/.*requirements.*|
.vscode/extensions.json|
.vscode/settings.json|
examples/broken/encoding.yml|
examples/broken/encoding.j2|
examples/broken/yaml-with-tabs/invalid-due-tabs.yaml|
Expand All @@ -31,9 +29,9 @@ repos:
- repo: meta
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/mirrors-prettier
- repo: https://github.com/rbubley/mirrors-prettier
# keep it before yamllint
rev: v4.0.0-alpha.8
rev: v3.4.2
hooks:
- id: prettier
# Temporary excludes so we can gradually normalize the formatting
Expand All @@ -60,10 +58,9 @@ repos:
always_run: true
additional_dependencies:
- prettier@3.2.4
- prettier-plugin-toml@2.0.1
- prettier-plugin-sort-json@3.1.0
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.17.1
rev: v8.17.2
hooks:
- id: cspell
# entry: codespell --relative
Expand All @@ -76,6 +73,11 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
# ignore formatting-prettier to have an accurate prettier comparison
exclude: >
Expand Down Expand Up @@ -129,12 +131,20 @@ repos:
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict

- repo: https://github.com/pappasam/toml-sort
rev: v0.24.2
hooks:
- id: toml-sort-fix
alias: toml

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.5.0
hooks:
- id: tox-ini-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.3
rev: v0.9.4
hooks:
- id: ruff
args:
Expand All @@ -143,10 +153,6 @@ repos:
types_or: [python, pyi]
# - id: ruff-format # must be after ruff
# types_or: [python, pyi]
- repo: https://github.com/psf/black # must be after ruff
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
Expand Down Expand Up @@ -242,33 +248,34 @@ repos:
# stages: [manual]
- id: deps
name: Upgrade constraints files and requirements
files: ^(pyproject\.toml|requirements\.txt)$
files: ^(pyproject\.toml|.config/.*)$
always_run: true
language: python
language_version: "3.10" # minimal we support officially
entry: python3 -m uv pip compile -q --all-extras --output-file=.config/constraints.txt pyproject.toml --upgrade
pass_filenames: false
stages:
- manual
additional_dependencies:
- uv>=0.4.3
- uv>=0.5.21
- id: pip-compile
name: Check constraints files and requirements
files: ^(pyproject\.toml|requirements\.txt)$
files: ^(pyproject\.toml|\.config/.*)$
language: python
language_version: "3.10" # minimal we support officially
entry: python3 -m uv pip compile -q --all-extras --output-file=.config/constraints.txt pyproject.toml
pass_filenames: false
additional_dependencies:
- uv>=0.4.3
- uv>=0.5.21
- id: lock
name: Update requirements-lock.txt
alias: lock
always_run: true
entry: python3 -m uv pip compile -q --upgrade --output-file=.config/requirements-lock.txt pyproject.toml --strip-extras
files: ^.config\/.*requirements.*$
files: ^(pyproject\.toml|\.config/.*)$
language: python
language_version: "3.10" # minimal we support officially
pass_filenames: false
stages: [manual]
additional_dependencies:
- uv>=0.4.3
- uv>=0.5.21
6 changes: 5 additions & 1 deletion .taplo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[formatting]
# compatibility with toml-sort-fix pre-commit hook
# cspell: disable-next-line
# compatibility between toml-sort-fix pre-commit hook and panekj.even-betterer-toml extension
align_comments = false
array_trailing_comma = false
compact_arrays = true
compact_entries = false
compact_inline_tables = true
inline_table_expand = false
reorder_keys = true
39 changes: 19 additions & 20 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
{
"recommendations": [
"Tyriar.sort-lines",
"charliermarsh.ruff",
"esbenp.prettier-vscode",
"hbenl.vscode-test-explorer",
"ms-python.black-formatter",
"ms-python.isort",
"ms-python.mypy-type-checker",
"ms-python.pylint",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.live-server",
"redhat.ansible",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters",
"shardulm94.trailing-spaces",
"tamasfe.even-better-toml",
"timonwong.shellcheck",
"znck.grammarly",
]
"recommendations": [
"Tyriar.sort-lines",
"charliermarsh.ruff",
"esbenp.prettier-vscode",
"hbenl.vscode-test-explorer",
"ms-python.isort",
"ms-python.mypy-type-checker",
"ms-python.pylint",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.live-server",
"redhat.ansible",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters",
"shardulm94.trailing-spaces",
"tamasfe.even-better-toml",
"timonwong.shellcheck",
"znck.grammarly"
]
}
93 changes: 42 additions & 51 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,45 @@
{
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.formatOnSave": true,
"evenBetterToml.formatter.allowedBlankLines": 2,
"files.exclude": {
"*.egg-info": true,
".pytest_cache": true,
".tox": true,
"__pycache__": true,
"build": true
},
"git.ignoreLimitWarning": true,
"grammarly.config.documentDomain": "academic",
"grammarly.files.include": [
"**/*.txt",
"**/*.md"
],
"python.experiments.optInto": [
"pythonTestAdapter"
],
"python.terminal.activateEnvironment": true,
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"mypy-type-checker.severity": {
"error": "Warning",
},
"sortLines.filterBlankLines": true,
"yaml.completion": true,
"yaml.customTags": [
"!encrypted/pkcs1-oaep scalar",
"!vault scalar"
],
"yaml.format.enable": false,
"yaml.validate": true,
"evenBetterToml.formatter.alignComments": false,
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll": "explicit"
},
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"evenBetterToml.formatter.arrayTrailingComma": true,
"[toml]": {
"editor.defaultFormatter": "panekj.even-betterer-toml"
},
"sonarlint.connectedMode.project": {
"connectionId": "ansible",
"projectKey": "ansible_ansible-lint"
}
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true
},
"[toml]": {
"editor.defaultFormatter": "panekj.even-betterer-toml"
},
"editor.formatOnSave": true,
"evenBetterToml.formatter.alignComments": false,
"evenBetterToml.formatter.arrayTrailingComma": true,
"files.exclude": {
"*.egg-info": true,
".pytest_cache": true,
".tox": true,
"__pycache__": true,
"build": true
},
"git.ignoreLimitWarning": true,
"grammarly.config.documentDomain": "academic",
"grammarly.files.include": ["**/*.txt", "**/*.md"],
"mypy-type-checker.severity": {
"error": "Warning"
},
"python.experiments.optInto": ["pythonTestAdapter"],
"python.terminal.activateEnvironment": true,
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"sonarlint.connectedMode.project": {
"connectionId": "ansible",
"projectKey": "ansible_ansible-lint"
},
"sortLines.filterBlankLines": true,
"yaml.completion": true,
"yaml.customTags": ["!encrypted/pkcs1-oaep scalar", "!vault scalar"],
"yaml.format.enable": false,
"yaml.validate": true
}
1 change: 1 addition & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ ignorePaths:
- src/ansiblelint/schemas/*.json
# Other
- "*.svg"
- ".vscode/**"
Loading

0 comments on commit 5314965

Please sign in to comment.