Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding basic tooling: link, spell, and formatting checks #1305

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
702 changes: 702 additions & 0 deletions .cspell.yml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ repository:
homepage: https://mentoring.cncf.io

labels:
- name: CI/infra
description: CI & infrastructure
color: #696969
- name: lfx mentorship
color: a2dcf2
- name: enhancement
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Format checks

on:
pull_request:

jobs:
format-check:
name: FILE FORMAT
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: package.json
- run: npm run check:format

markdown-linter:
name: MARKDOWN linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: package.json
- run: npm run check:markdown
18 changes: 18 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Link checks

on:
pull_request:

jobs:
link-check:
name: LINK checking
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: package.json
- name: Check file format
run: npm run check:links
18 changes: 18 additions & 0 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Spelling checks

on:
pull_request:

jobs:
spelling-check:
name: SPELLING check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: package.json
- name: Check file format
run: npm run check:spelling
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# npm assets
node_modules/
package-lock.json
19 changes: 19 additions & 0 deletions .markdown-link-check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"ignorePatterns": [
{
"pattern": "^http://localhost"
},
{
"pattern": "^#"
},
{
"pattern": "^https://(www|docs).tremor.rs"
},
{
"pattern": "\\?no-link-check$"
}
],
"timeout": "3s",
"retryOn429": true,
"aliveStatusCodes": [200, 206]
}
5 changes: 5 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
# and https://github.com/DavidAnson/markdownlint/blob/main/README.md

list-marker-space: false
no-inline-html: false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/*
43 changes: 43 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "mentoring",
"version": "0.0.0",
"description": "Resources provided for and by the CNCF Mentoring community",
"scripts": {
"_check:format:any": "npx prettier --check --ignore-path ''",
"_check:format:delta": "npm run _check:format:any -- $(npm run -s _list:git:delta)",
"_check:format": "npx prettier --check .",
"_check:links": "npx markdown-link-check --config .markdown-link-check.json",
"_check:markdown:all": "npm run -s _list:check:md | xargs -I {} -P 4 npx -p markdownlint-cli markdownlint -c .markdownlint.yaml {}",
"_check:markdown:delta": "npm run -s _list:git:delta | xargs -I {} npx -p markdownlint-cli markdownlint -c .markdownlint.yaml {}",
"_check:markdown:1": "npx -p markdownlint-cli markdownlint -c .markdownlint.yaml",
"_list:git:delta": "git diff --name-only --diff-filter=ACMR | grep -E '\\.(js|md|scss|yml|yaml)$'",
"_list:check:md:no-analysis": "find . -name '*.md' -not -path '*/node_modules/*' -a -not -path '*/.?*' -a -not -path '*/00*'",
"_list:check:md": "find . -name '*.md' -not -path '*/node_modules/*' -a -not -path '*/.?*' | grep -Eve '/000|/0010|/0011'",
"_list:check:*": "npm run --loglevel=warn | grep -Ee '^\\s*check:[^:]+$'",
"_list:fix:*": "npm run --loglevel=warn | grep -Ee '^\\s*fix:[^:]+$' | grep -v 'fix:all'",
"check:format": "npm run _check:format || (echo '[help] Run: npm run fix:format'; exit 1)",
"check:links": "bash -c 'find . -type f -name \"*.md\" -not -path \"*/node_modules/*\" -print0 | xargs -0 -I {} npx markdown-link-check --config .markdown-link-check.json {} || exit 1'",
"check:markdown": "npm run _check:markdown:all",
"check:spelling": "npx cspell --no-progress -c .cspell.yml **/*.md",
"check": "npm run seq -- $(npm run -s _list:check:*)",
"fix:format": "npm run _check:format -- --write",
"fix": "npm run seq -- $(npm -s run _list:fix:*)",
"seq": "bash -c 'for cmd in \"$@\"; do npm run $cmd || exit 1; done' - ",
"test": "npm run check"
},
"author": "CNCF",
"license": "CC-BY-4.0",
"devDependencies": {
"cspell": "^8.8.4",
"markdown-link-check": "^3.12.2",
"markdownlint": "^0.34.0",
"markdownlint-cli": "^0.41.0",
"prettier": "^3.3.2"
},
"private": true,
"spelling": "cSpell:ignore ACMR loglevel -",
"prettier": {
"proseWrap": "always",
"singleQuote": true
}
}
Loading