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

Tooling for markdown linting #19425

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Zanda256
Copy link

@Zanda256 Zanda256 commented Feb 16, 2025

With this pull request, we add a bash script to run linting check on modified or newly added markdown files. We then add a makefile target to run the script using make.

Partially resolves #18059

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Zanda256
Once this PR has been reviewed and has the lgtm label, please assign spzala for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link

Hi @Zanda256. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

The script runs markdown lint on newly created markdown files, or modified lines in old files.

Signed-off-by: Sekiranda Hamza sekirandahamza@gmail.com
Signed-off-by: Sekiranda <sekirandahamza@gmail.com>
Signed-off-by: Sekiranda Hamza sekirandahamza@gmail.com

Signed-off-by: Sekiranda <sekirandahamza@gmail.com>
@Zanda256 Zanda256 force-pushed the tooling_markdown_lint branch from f65e917 to ea90940 Compare February 16, 2025 01:40
@joshjms
Copy link
Contributor

joshjms commented Feb 17, 2025

#18059

@Zanda256 Zanda256 marked this pull request as ready for review February 17, 2025 19:41
@Zanda256 Zanda256 marked this pull request as draft February 17, 2025 19:53
Signed-off-by: Sekiranda <sekirandahamza@gmail.com>
@Zanda256 Zanda256 marked this pull request as ready for review February 17, 2025 23:07
@ivanvc ivanvc self-requested a review February 18, 2025 05:23
@ivanvc
Copy link
Member

ivanvc commented Feb 21, 2025

/ok-to-test

@Zanda256
Copy link
Author

@ivanvc could we please give the failing tests a re-run?

@ivanvc
Copy link
Member

ivanvc commented Feb 24, 2025

@ivanvc could we please give the failing tests a re-run?

Yes, you can also do it by yourself by commenting:

/retest

Note: I haven't forgotten about this pull request, but I haven't been able to review it as I have other things in my backlog. I'll return to this soon ✌️

Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.90%. Comparing base (8c52b41) to head (c869284).
Report is 50 commits behind head on main.

Additional details and impacted files

see 29 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #19425      +/-   ##
==========================================
- Coverage   68.97%   68.90%   -0.08%     
==========================================
  Files         420      420              
  Lines       35753    35762       +9     
==========================================
- Hits        24662    24641      -21     
- Misses       9664     9701      +37     
+ Partials     1427     1420       -7     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c52b41...c869284. Read the comment docs.

Copy link
Member

@ivanvc ivanvc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request, @Zanda256. I'm sorry for not getting back to you sooner. I left a couple of comments/suggestions. Thanks again :)

Comment on lines 13 to 24
COLOR_RED='\033[0;31m'
COLOR_BOLD='\033[1m'
COLOR_ORANGE='\033[0;33m'
COLOR_NONE='\033[0m' # No Color

function log_error {
echo -n -e "${COLOR_BOLD}${COLOR_RED}$*${COLOR_NONE}\n"
}

function log_warning {
echo -n -e "${COLOR_ORANGE}$*${COLOR_NONE}\n"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can benefit from sourcing scripts/test_lib.sh, which defines these functions and color codes. Therefore, we can remove these definitions.

Makefile Outdated

.PHONY: markdown-diff-lint
markdown-diff-lint:
./scripts/markdown_diff_lint.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we keep the linebreak in the last line of the file?

done
if [ "${#files_with_failures[@]}" -gt "0" ]; then
exit 1
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we keep the linebreak in the last line of the file?

Comment on lines +8 to +9
echo "markdownlint-cli2 needs to be installed."
echo "Please refer to https://github.com/DavidAnson/markdownlint-cli2?tab=readme-ov-file#install for installation instructions."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we source test_lib.sh. These two lines can be changed to log_errror ....

Signed-off-by: Sekiranda <sekirandahamza@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Find a replacement for marker (markdown linter)
4 participants