# Refer for explanation to following link: # https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md # pre-commit: parallel: true commands: deprecated-markdown-patterns: tags: lint glob: "content/**/*.md" run: | errors=0 # Check for deprecated code-placeholders shortcode if grep -l '{{% code-placeholders' {staged_files} 2>/dev/null; then echo "❌ Found deprecated {{% code-placeholders %}} shortcode." echo " Use \`\`\`language { placeholders=\"...\" } instead." errors=1 fi # Check for abbreviated 'py' language identifier if grep -lE '^\s*```py(\s|$)' {staged_files} 2>/dev/null; then echo "❌ Found abbreviated 'py' code fence language." echo " Use 'python' instead of 'py' for code fences." errors=1 fi exit $errors fail_text: "Deprecated markdown patterns found. See messages above for details." eslint-debug-check: glob: "assets/js/*.js" run: yarn eslint {staged_files} fail_text: "Debug helpers found! Remove debug imports and calls before committing." build-agent-instructions: glob: "data/products.yml" run: yarn build:agent:instructions # Auto-fix markdown formatting for instruction and README files (like prettier) lint-markdown-instructions: tags: lint glob: - "README.md" - "[A-Z]*.md" - ".github/**/*.md" - ".claude/**/*.md" run: | # Filter out content and layout files (shortcode .md files contain Hugo template syntax # that remark-lint would escape), then prepend /workdir/ to each remaining file files=$(echo '{staged_files}' | tr ' ' '\n' | grep -v '^content/' | grep -v '^layouts/' | sed 's|^|/workdir/|' | tr '\n' ' ' | sed 's/ $//') if [ -n "$files" ]; then docker compose run --rm --name remark-lint remark-lint $files --output --quiet || \ { echo "⚠️ Remark found formatting issues in instruction files. Automatic formatting applied."; } fi stage_fixed: true # Lint instruction and repository documentation files with generic Vale config lint-instructions: tags: lint glob: "{[A-Z]*.md,.github/**/*.md,.claude/**/*.md,api-docs/README.md}" run: '.ci/vale/vale.sh --config=.vale-instructions.ini --minAlertLevel=warning {staged_files}' cloud-lint: tags: lint,v2 glob: 'content/influxdb/cloud/*.md' run: '.ci/vale/vale.sh --config=.vale.ini --minAlertLevel=error {staged_files}' cloud-dedicated-lint: tags: lint,v3 glob: - 'content/influxdb3/cloud-dedicated/*.md' - 'content/shared/*.md' run: '.ci/vale/vale.sh --config=content/influxdb3/cloud-dedicated/.vale.ini --minAlertLevel=error {staged_files}' cloud-serverless-lint: tags: lint,v3 glob: - 'content/influxdb3/cloud-serverless/*.md' - 'content/shared/*.md' run: '.ci/vale/vale.sh --config=content/influxdb3/cloud-serverless/.vale.ini --minAlertLevel=error {staged_files}' clustered-lint: tags: lint,v3 glob: - 'content/influxdb3/clustered/*.md' - 'content/shared/*.md' run: '.ci/vale/vale.sh --config=content/influxdb3/cloud-serverless/.vale.ini --minAlertLevel=error {staged_files}' core-lint: tags: lint,v3 glob: - 'content/influxdb3/core/*.md' - 'content/shared/*.md' run: '.ci/vale/vale.sh --config=.vale.ini --minAlertLevel=error {staged_files}' enterprise-lint: tags: lint,v3 glob: - 'content/influxdb3/enterprise/*.md' - 'content/shared/*.md' run: '.ci/vale/vale.sh --config=.vale.ini --minAlertLevel=error {staged_files}' explorer-lint: tags: lint,clients glob: 'content/influxdb3/explorer/*.md' run: '.ci/vale/vale.sh --config=.vale.ini --minAlertLevel=error {staged_files}' telegraf-lint: tags: lint,clients glob: 'content/telegraf/*.md' run: '.ci/vale/vale.sh --config=.vale.ini --minAlertLevel=error {staged_files}' v2-lint: tags: lint,v2 glob: 'content/influxdb/v2/*.md' run: '.ci/vale/vale.sh --config=content/influxdb/v2/.vale.ini --minAlertLevel=error {staged_files}' build-typescript: glob: "assets/js/*.ts" run: yarn build:ts stage_fixed: true prettier: tags: [frontend, style] glob: '*.{css,js,ts,jsx,tsx}' run: | yarn prettier --write --loglevel silent "{staged_files}" > /dev/null 2>&1 || { echo "⚠️ Prettier found formatting issues. Automatic formatting applied." git add {staged_files} } lint-js: glob: "assets/js/*.{js,ts}" run: yarn eslint {staged_files} fail_text: "JavaScript linting failed. Fix errors before committing." shellcheck: tags: lint glob: "*.sh" exclude: - "shared/text/**/*.sh" - "layouts/shortcodes/**/*.sh" - "node_modules/**" run: .ci/shellcheck/shellcheck.sh {staged_files} fail_text: "ShellCheck found issues in shell scripts. Fix errors before committing." pre-push: commands: packages-audit: tags: frontend security run: yarn audit e2e-shortcode-examples: tags: [frontend, test] glob: - assets/*.{js,mjs,css,scss} - layouts/*.html - content/example.md run: | echo "Running shortcode examples test due to changes in: {staged_files}" node cypress/support/run-e2e-specs.js --spec "cypress/e2e/content/index.cy.js" content/example.md exit $? # Manage Docker containers prune-legacy-containers: priority: 1 tags: test run: '(docker container ls --format "{{.ID}}" --filter label=tag=influxdata-docs --filter status=exited | xargs docker rm) || true' build-pytest-image: tags: test run: yarn build:pytest:image # Test code blocks in markdown files cloud-pytest: glob: content/influxdb/cloud/*.md tags: test,codeblocks,v2 env: SERVICE: cloud-pytest run: yarn test:codeblocks:cloud '{staged_files}' cloud-dedicated-pytest: tags: test,codeblocks,v3 glob: content/influxdb3/cloud-dedicated/*.md run: | yarn test:codeblocks:cloud-dedicated '{staged_files}' && ./test/scripts/monitor-tests.sh stop cloud-dedicated-pytest cloud-serverless-pytest: tags: test,codeblocks,v3 glob: content/influxdb3/cloud-serverless/*.md env: SERVICE: cloud-serverless-pytest run: yarn test:codeblocks:cloud-serverless '{staged_files}' clustered-pytest: tags: test,codeblocks,v3 glob: content/influxdb3/clustered/*.md run: | yarn test:codeblocks:clustered '{staged_files}' && ./test/scripts/monitor-tests.sh stop clustered-pytest telegraf-pytest: tags: test,codeblocks glob: content/telegraf/*.md env: SERVICE: telegraf-pytest run: yarn test:codeblocks:telegraf '{staged_files}' v2-pytest: tags: test,codeblocks,v2 glob: content/influxdb/v2/*.md env: SERVICE: v2-pytest run: yarn test:codeblocks:v2 '{staged_files}'