Skip to content

Commit

Permalink
adding basic tooling: link, spell, & formatting checks
Browse files Browse the repository at this point in the history
Signed-off-by: Nate W <[email protected]>
  • Loading branch information
nate-double-u committed Aug 21, 2024
1 parent 6207cf4 commit 1800d18
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .cspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# cSpell:ignore textlintrc
# For settings, see
# https://www.streetsidesoftware.com/vscode-spell-checker/docs/configuration/
version: '0.2'
caseSensitive: true
#ignorePaths:
# Temporary
# - /assessments/
# patterns:
# - name: CodeBlock
# pattern: |
# /
# ^(\s*[~`]{3,}) # code-block start
# .* # all languages and options, e.g. shell {hl_lines=[12]}
# [\s\S]*? # content
# \1 # code-block end
# /igmx # cspell:disable-line
# languageSettings:
# - languageId: markdown
# ignoreRegExpList:
# - CodeBlock
words:
- backstore
- CNCF
- Docsy
- keda
- kedacore
- mentee
- mentees
- summerofcode
- outreachy
- techdocs
- toto
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 'for f in *.md `find docs analyses -name \"*.md\"`; do npx markdown-link-check --config .markdown-link-check.json $f || exit 1; done'",
"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
}
}

0 comments on commit 1800d18

Please sign in to comment.