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

[WIP] Add local Markdown checks #330

Draft
wants to merge 6 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
4 changes: 4 additions & 0 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"MD041": false
},

"globs": [
"**/*.md"
],

"ignores": [
"doc/api/"
]
Expand Down
17 changes: 17 additions & 0 deletions tool/check_markdown_links.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
# check_markdown_links.sh
# Check Markdown links.
#
# 2023 February 23
# Author: Chykon

set -euo pipefail

config_file='.github/configs/mlc_config.json'
markdown_files=$(find . -path './doc/api' -prune -false -or -type f -name '*.md')

echo "${markdown_files}" | xargs npx markdown-link-check --quiet --config ${config_file}
14 changes: 14 additions & 0 deletions tool/lint_markdown_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
# lint_markdown_files.sh
# Lint Markdown files.
#
# 2023 February 23
# Author: Chykon

set -euo pipefail

npx markdownlint-cli2
11 changes: 9 additions & 2 deletions tool/run_checks.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/bin/bash

# Copyright (C) 2022 Intel Corporation
# Copyright (C) 2022-2023 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
# run_checks.sh
# Run project checks.
#
# 2022 October 11
# Author: Chykon
#

set -euo pipefail

Expand All @@ -31,6 +30,14 @@ trap trap_error ERR

printf '\n%s\n' "${form_bold}${color_yellow}Running local checks...${text_reset}"

# Lint Markdown files
print_step 'Lint Markdown files'
tool/lint_markdown_files.sh

# Check Markdown links
print_step 'Check Markdown links'
tool/check_markdown_links.sh

# Install project dependencies
print_step 'Install project dependencies'
tool/gh_actions/install_dependencies.sh
Expand Down