Skip to content

Commit

Permalink
Update pre-commit hooks (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Jun 17, 2024
1 parent 863fd69 commit c6b6ef1
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 29 deletions.
4 changes: 4 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
exclude_paths:
- .cache/ # implicit unless exclude_paths is defined in config
- mkdocs.yml # https://github.com/ansible/ansible-lint/issues/4222
64 changes: 64 additions & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Fosstodon
PYTHONBREAKPOINT
PYTHONHASHSEED
PYTHONHTTPSVERIFY
PYTHONIOENCODING
PYTHONPYCACHEPREFIX
REQPASS
Sbarnea
Sorin
autorefs
basepython
cairosvg
codenotify
codespell
configfile
cookiecutter
devel
diskcache
distros
envdir
envlist
envname
facelessuser
fontawesome
gerrit
gitreview
hashseed
htmlproofer
inlinehilite
linejoin
linenums
magiclink
markdownlint
minversion
mkdocs
newhostkey
nocows
nosetests
notest
noxfile
outdir
passenv
pipdeptree
pluggy
posargs
programdata
protobuf
pymdown
pymdownx
pypa
pypackage
setenv
showconfig
showlocals
ssbarnea
superfences
taskfile
taskfiles
testenv
toxenv
toxinidir
typer
typeshed
usedevelop
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ updates:
dependencies:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
labels:
- "dependencies"
- "skip-changelog"
- dependencies
- skip-changelog
1 change: 0 additions & 1 deletion .github/workflows/ack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ name: ack
on:
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]

jobs:
ack:
uses: ansible/team-devtools/.github/workflows/ack.yml@main
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
push:
branches:
- main
- "releases/**"
- "stable/**"
- releases/**
- stable/**

jobs:
ack:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ name: release
on:
release:
types: [published]

jobs:
pypi:
name: Publish to PyPI registry
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ name: tox
on:
push: # only publishes pushes to the main branch to TestPyPI
branches: # any integration branch but not tag
- "main"
- main
pull_request:
branches:
- "main"
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
Expand Down Expand Up @@ -105,8 +105,7 @@ jobs:
printf '### Failed as git reported modified and/or untracked files\n```\n%s\n```\n' "$(git status -s)" | tee -a "$GITHUB_STEP_SUMMARY"
exit 99
fi
# https://github.com/actions/toolkit/issues/193

# https://github.com/actions/toolkit/issues/193
check: # This job does nothing and is only used for the branch protection
if: always()
permissions:
Expand Down
33 changes: 25 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
ci:
skip: [markdownlint_docker]
skip:
- markdownlint_docker
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.9"
rev: v0.4.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args:
- --fix
- --exit-non-zero-on-fix
- repo: https://github.com/pre-commit/mirrors-prettier
# keep it before yamllint
rev: v4.0.0-alpha.8
hooks:
- id: prettier
Expand All @@ -17,6 +19,14 @@ repos:
- prettier
- prettier-plugin-toml
- prettier-plugin-sort-json
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.8.2
hooks:
- id: cspell
# entry: codespell --relative
args: [--relative, --no-progress, --no-summary]
name: Spell check with cspell

- repo: https://github.com/markdownlint/markdownlint.git
rev: v0.12.0
hooks:
Expand All @@ -25,7 +35,8 @@ repos:
rev: 24.4.2
hooks:
- id: black
args: [--safe]
args:
- --safe
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
Expand All @@ -37,19 +48,25 @@ repos:
- id: check-merge-conflict
- id: debug-statements
language_version: python3
- repo: https://github.com/ansible/ansible-lint
rev: v24.6.0
hooks:
- id: ansible-lint
args: [--fix]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
types:
- file
- yaml
entry: yamllint --strict
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
hooks:
- id: mypy
# mypy args needed in order to match mypy cli behavior
args: ["--python-version", "3.10"]
args: [--python-version, "3.10"]
entry: mypy src/
pass_filenames: false
additional_dependencies:
Expand Down
3 changes: 2 additions & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ rules:
comments:
# prettier compatibility
min-spaces-from-content: 1
comments-indentation: false
document-start:
present: true
line-length: disable
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
truthy:
allowed-values: ['true', 'false', 'on']
check-keys: false
21 changes: 21 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
dictionaryDefinitions:
- name: words
path: .config/dictionary.txt
addWords: true
dictionaries:
# Use `cspell-cli trace word` to check where a work is defined
- en_US
- bash
- words
- python
- python-common
ignorePaths:
- cspell.config.yaml
# The requirements file
- .config/constraints.txt
- ./samples/integration/*.*
- .config/requirements.txt
- .config/requirements.in
# Other
- "*.svg"
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extra_css:
- stylesheets/extra.css

theme:
name: "material"
name: material
custom_dir: docs/.overrides
logo: images/logo.svg
favicon: images/favicon.ico
Expand Down
3 changes: 2 additions & 1 deletion playbooks/example-playbook.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
- hosts: localhost
- name: Empty playbook
hosts: localhost
6 changes: 2 additions & 4 deletions playbooks/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
ansible.builtin.debug:
msg: Using {{ cache_dir }} for temporary files

- name: Clone repo # noqa: git-latest
- name: Clone repo # noqa: latest[git]
ansible.builtin.git:
accept_newhostkey: true
repo: "{{ item.url }}"
Expand Down Expand Up @@ -55,9 +55,7 @@
args:
chdir: "{{ (cache_dir, item.name) | path_join }}"
vars:
output_dir:
"{{ (playbook_dir, '..', 'samples', 'integration') | path_join |
realpath }}"
output_dir: "{{ (playbook_dir, '..', 'samples', 'integration') | path_join | realpath }}"
register: result
loop: "{{ repos }}"
changed_when: false
Expand Down
4 changes: 2 additions & 2 deletions src/mk/tools/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def up(self):
fail("Failed to create upstream")

if tracking_branch is None:
logging.debug("We do not have atracking branch")
logging.debug("We do not have a tracking branch")
else:
logging.debug("Performing a git push")

Expand All @@ -91,7 +91,7 @@ def up(self):
# https://github.com/cli/cli/issues/1718

# --web option is of not use because it happens too soon, confusing github
logging.debug("Tryging to detect if there are existing PRs open")
logging.debug("Trying to detect if there are existing PRs open")
result = run_or_fail(
["gh", "pr", "list", "-S", f"head:{repo.active_branch}"],
)
Expand Down

0 comments on commit c6b6ef1

Please sign in to comment.