-
Notifications
You must be signed in to change notification settings - Fork 943
chore: adopt markdownlint and markdown-table-formatter for *.md #15831
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
Changes from 75 commits
fe34c79
5d1429a
a8b2217
8df4ea1
819074c
150fdef
4a1fb29
acee64b
9109a7e
a6b8f83
6e8aa60
9f14438
40a94f1
43435a5
1da5f23
59a92c9
34ca8cb
4dc14ea
b7331df
fcaa917
e9431a6
2f84e0f
e3ac0b1
9ccfcfd
7d5b411
3b396d3
44ceda1
847a8f3
4ed47fc
89fec9a
6d5006a
0471071
981d7b5
d11102a
e14d543
f1305d0
3670fa7
e1eec2f
f3652f7
34ceccf
868d3fa
3c2c4da
8cdd668
223cd4d
6de5e1d
2ed285f
eb3504c
7b7308b
95d5574
d8fb439
db200bb
60a5a4a
691cf5c
c9afb8b
79abf5f
7a326bd
f6c652a
ab64ced
fd042dd
c9bc320
a38312a
3417860
bd31583
9b0f28a
917d6b3
ad73e4e
90acaca
979a283
34aa71b
6abc05a
a291686
a61d20d
e384d0a
f0cb88d
4e83922
504a1ed
4cea376
1637783
5392bb7
15f21eb
b733ad1
0d41834
f97ce22
687b015
fe265eb
33f4b81
11dd374
43f568b
dadc689
c375423
6b95860
8fefeef
8731666
9f6adaa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Docs CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2 97AE .1 | ||
matifali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node | ||
uses: ./.github/actions/setup-node | ||
|
||
- uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366 # v45.0.5 | ||
matifali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
id: changed-files | ||
with: | ||
files: "docs/**/*.md" | ||
matifali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
separator: "," | ||
|
||
- name: lint | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
run: | | ||
pnpm exec markdownlint-cli2 ${{ steps.changed-files.outputs.all_changed_files }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works now but could at some point fail with a shell error: argument list too long. Using xargs is one option and maybe markdown-lint has some other built-in function. If a file has spaces that would also be problematic. |
||
|
||
- name: fmt | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
run: | | ||
# markdown-table-formatter requires a space separated list of files | ||
echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ',' '\n' | pnpm exec markdown-table-formatter --check | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before, you could just add xargs in front of pnpm here. You could use null instead of newline ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this - seems like it might make it easier to debug issues later too something like a commented out debug line that writes the env contents into a file? is that possible/useful? I'm not sure what it would specifically look like or if it's a cat <<< "$changed-files" > "list-changed-files.txt"
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mafredri I am leaving the suggestions here out of this PR. I need to learn the risks here and can address them in a follow-up PR. I also welcome you taking a jab at this. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this file support json comment syntax? If yes, might be nice to detail why we change some of these rules. Otherwise it's could be nice to stick to stock settings as close as possible, given that it has sane defaults. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will add comments and convert to |
||
"MD009": true, | ||
"MD010": false, | ||
"MD012": true, | ||
"MD013": false, | ||
"MD022": true, | ||
"MD024": { "siblings_only": true}, | ||
"MD029": false, | ||
"MD031": true, | ||
"MD033": false, | ||
"MD034": true, | ||
"MD036": true, | ||
"MD041": false, | ||
"MD045": true, | ||
"MD052": false, | ||
"MD055": false, | ||
"MD056": false | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
{ | ||
"recommendations": [ | ||
"biomejs.biome", | ||
"bradlc.vscode-tailwindcss", | ||
"DavidAnson.vscode-markdownlint", | ||
"EditorConfig.EditorConfig", | ||
"emeraldwalk.runonsave", | ||
"foxundermoon.shell-format", | ||
"github.vscode-codeql", | ||
"golang.go", | ||
"hashicorp.terraform", | ||
"esbenp.prettier-vscode", | ||
matifali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"foxundermoon.shell-format", | ||
"emeraldwalk.runonsave", | ||
"zxh404.vscode-proto3", | ||
"redhat.vscode-yaml", | ||
"tekumara.typos-vscode", | ||
"EditorConfig.EditorConfig", | ||
"biomejs.biome", | ||
"bradlc.vscode-tailwindcss" | ||
"zxh404.vscode-proto3" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -414,7 +414,7 @@ BOLD := $(shell tput bold 2>/dev/null) | |
GREEN := $(shell tput setaf 2 2>/dev/null) | ||
RESET := $(shell tput sgr0 2>/dev/null) | ||
|
||
fmt: fmt/ts fmt/go fmt/terraform fmt/shfmt fmt/prettier | ||
fmt: fmt/ts fmt/go fmt/terraform fmt/shfmt fmt/biome fmt/markdown | ||
.PHONY: fmt | ||
|
||
fmt/go: | ||
|
@@ -438,15 +438,16 @@ else | |
endif | ||
.PHONY: fmt/ts | ||
|
||
fmt/prettier: .prettierignore | ||
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/prettier$(RESET)" | ||
fmt/biome: | ||
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/biome$(RESET)" | ||
cd site | ||
# Avoid writing files in CI to reduce file write activity | ||
ifdef CI | ||
pnpm run format:check | ||
else | ||
pnpm run format | ||
endif | ||
.PHONY: fmt/prettier | ||
.PHONY: fmt/biome | ||
|
||
fmt/terraform: $(wildcard *.tf) | ||
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/terraform$(RESET)" | ||
|
@@ -463,7 +464,13 @@ else | |
endif | ||
.PHONY: fmt/shfmt | ||
|
||
lint: lint/shellcheck lint/go lint/ts lint/examples lint/helm lint/site-icons | ||
fmt/markdown: | ||
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/markdown$(RESET)" | ||
./scripts/pnpm_install.sh | ||
pnpm format-docs | ||
.PHONY: fmt/markdown | ||
|
||
lint: lint/shellcheck lint/go lint/ts lint/examples lint/helm lint/site-icons lint/markdown | ||
.PHONY: lint | ||
|
||
lint/site-icons: | ||
|
@@ -497,6 +504,11 @@ lint/helm: | |
make lint | ||
.PHONY: lint/helm | ||
|
||
lint/markdown: | ||
./scripts/pnpm_install.sh | ||
pnpm lint-docs | ||
.PHONY: lint/markdown | ||
|
||
# All files generated by the database should be added here, and this can be used | ||
# as a target for jobs that need to run after the database is generated. | ||
DB_GEN_FILES := \ | ||
|
@@ -530,8 +542,6 @@ GEN_FILES := \ | |
docs/reference/cli/index.md \ | ||
docs/admin/security/audit-logs.md \ | ||
coderd/apidoc/swagger.json \ | ||
.prettierignore.include \ | ||
.prettierignore \ | ||
provisioner/terraform/testdata/version \ | ||
site/e2e/provisionerGenerated.ts \ | ||
site/src/theme/icons.json \ | ||
|
@@ -563,8 +573,6 @@ gen/mark-fresh: | |
docs/reference/cli/index.md \ | ||
docs/admin/security/audit-logs.md \ | ||
coderd/apidoc/swagger.json \ | ||
.prettierignore.include \ | ||
.prettierignore \ | ||
site/e2e/provisionerGenerated.ts \ | ||
site/src/theme/icons.json \ | ||
examples/examples.gen.json \ | ||
|
@@ -653,11 +661,15 @@ site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisio | |
|
||
site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*) | ||
go run ./scripts/gensite/ -icons "$@" | ||
./scripts/pnpm_install.sh | ||
pnpm -C site/ exec biome format --write src/theme/icons.json | ||
cd site | ||
../scripts/pnpm_install.sh | ||
pnpm exec biome format --write src/theme/icons.json | ||
|
||
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates) | ||
go run ./scripts/examplegen/main.go > examples/examples.gen.json | ||
cd site | ||
../scripts/pnpm_install.sh | ||
pnpm exec biome format --write ../examples/examples.gen.json | ||
|
||
coderd/rbac/object_gen.go: scripts/typegen/rbacobject.gotmpl scripts/typegen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go | ||
tempdir=$(shell mktemp -d /tmp/typegen_rbac_object.XXXXXX) | ||
|
@@ -680,22 +692,32 @@ site/src/api/countriesGenerated.ts: scripts/typegen/countries.tstmpl scripts/typ | |
docs/admin/integrations/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics | ||
go run scripts/metricsdocgen/main.go | ||
./scripts/pnpm_install.sh | ||
pnpm exec prettier --write ./docs/admin/integrations/prometheus.md | ||
pnpm exec markdownlint-cli2 --fix ./docs/admin/integrations/prometheus.md | ||
pnpm exec markdown-table-formatter ./docs/admin/integrations/prometheus.md | ||
|
||
docs/reference/cli/index.md: scripts/clidocgen/main.go examples/examples.gen.json $(GO_SRC_FILES) | ||
CI=true BASE_PATH="." go run ./scripts/clidocgen | ||
./scripts/pnpm_install.sh | ||
pnpm exec prettier --write ./docs/reference/cli/index.md ./docs/reference/cli/*.md ./docs/manifest.json | ||
pnpm exec markdownlint-cli2 --fix ./docs/reference/cli/*.md | ||
pnpm exec markdown-table-formatter ./docs/reference/cli/*.md | ||
matifali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cd site | ||
../scripts/pnpm_install.sh | ||
pnpm exec biome format --write ../docs/manifest.json | ||
|
||
docs/admin/security/audit-logs.md: coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go | ||
go run scripts/auditdocgen/main.go | ||
./scripts/pnpm_install.sh | ||
pnpm exec prettier --write ./docs/admin/security/audit-logs.md | ||
pnpm exec markdownlint-cli2 --fix ./docs/admin/security/audit-logs.md | ||
pnpm exec markdown-table-formatter ./docs/admin/security/audit-logs.md | ||
|
||
coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS) -type f) $(wildcard coderd/*.go) $(wildcard enterprise/coderd/*.go) $(wildcard codersdk/*.go) $(wildcard enterprise/wsproxy/wsproxysdk/*.go) $(DB_GEN_FILES) .swaggo docs/manifest.json coderd/rbac/object_gen.go | ||
./scripts/apidocgen/generate.sh | ||
./scripts/pnpm_install.sh | ||
pnpm exec prettier --write ./docs/reference/api ./docs/manifest.json ./coderd/apidoc/swagger.json | ||
pnpm exec markdownlint-cli2 --fix ./docs/reference/api/*.md | ||
pnpm exec markdown-table-formatter ./docs/reference/api/*.md | ||
cd site | ||
../scripts/pnpm_install.sh | ||
pnpm exec biome format --write ../docs/manifest.json ../coderd/apidoc/swagger.json | ||
|
||
update-golden-files: \ | ||
cli/testdata/.gen-golden \ | ||
|
@@ -756,15 +778,6 @@ scripts/ci-report/testdata/.gen-golden: $(wildcard scripts/ci-report/testdata/*) | |
go test ./scripts/ci-report -run=TestOutputMatchesGoldenFile -update | ||
touch "$@" | ||
|
||
# Combine .gitignore with .prettierignore.include to generate .prettierignore. | ||
.prettierignore: .gitignore .prettierignore.include | ||
echo "# Code generated by Makefile ($^). DO NOT EDIT." > "$@" | ||
echo "" >> "$@" | ||
for f in $^; do | ||
echo "# $${f}:" >> "$@" | ||
cat "$$f" >> "$@" | ||
done | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do our replacement commands obey There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. most of the formatting is done by |
||
|
||
test: | ||
$(GIT_FLAGS) gotestsum --format standard-quiet -- -v -short -count=1 ./... | ||
.PHONY: test | ||
|
Uh oh!
There was an error while loading. Please reload this page.