diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9cd9e8c..fbaf96f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +default_install_hook_types: [pre-commit, pre-push] repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 @@ -39,3 +40,20 @@ repos: hooks: - id: shfmt args: [-w, -i, '2', -ci, -bn] + + - repo: https://github.com/DavidAnson/markdownlint-cli2 + rev: v0.24.2 + hooks: + - id: markdownlint-cli2 + exclude: ^CHANGELOG\.md$ + + - repo: local + hooks: + - id: mkdocs-build + name: mkdocs build (plex-guide, sample config) + language: python + additional_dependencies: ['mkdocs>=1.6.1,<2', mkdocs-material, mkdocs-macros-plugin] + entry: bash -c 'cd plex-guide && cp mkdocs.sample.yml mkdocs.yml && mkdocs build -q; rc=$?; rm -rf mkdocs.yml site; exit $rc' + pass_filenames: false + files: ^plex-guide/ + stages: [pre-push] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e507c66 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# Contributing + +## Development + +Run `pre-commit install` once per clone to install the commit and push hooks. + +- Commit hooks run markdownlint, ShellCheck, yamllint, and the other lint checks, matching CI. +- Push hooks build the Plex guide, matching CI. +- Run everything with `pre-commit run --all-files --hook-stage pre-push`. diff --git a/README.md b/README.md index 633a5dd..81d0a9f 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,10 @@ The sample config uses Material for MkDocs with a dark-first palette (slate) and ## Development +Run `pre-commit install` once per clone to install the commit and push hooks. Commit hooks run markdownlint, ShellCheck, yamllint, and the other lint checks, matching CI. Push hooks build the Plex guide, matching CI. Run everything with `pre-commit run --all-files --hook-stage pre-push`. + +To run the lint checks by hand: + ```bash npx markdownlint-cli2 "**/*.md" shellcheck plex-guide/setup.sh